Skip to content

Commit 0e8cf94

Browse files
Refactor.
1 parent 50fe7c0 commit 0e8cf94

File tree

1 file changed

+50
-44
lines changed

1 file changed

+50
-44
lines changed

PHP/CodeCoverage/Report/HTML.php

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -63,46 +63,54 @@ class PHP_CodeCoverage_Report_HTML
6363
protected $templatePath;
6464

6565
/**
66-
* @var array
66+
* @var string
6767
*/
68-
protected $options;
68+
protected $charset;
6969

7070
/**
71-
* Constructor.
72-
*
73-
* @param array $options
71+
* @var string
7472
*/
75-
public function __construct(array $options = array())
76-
{
77-
if (!isset($options['title'])) {
78-
$options['title'] = '';
79-
}
80-
81-
if (!isset($options['charset'])) {
82-
$options['charset'] = 'UTF-8';
83-
}
73+
protected $generator;
8474

85-
if (!isset($options['yui'])) {
86-
$options['yui'] = TRUE;
87-
}
75+
/**
76+
* @var integer
77+
*/
78+
protected $lowUpperBound;
8879

89-
if (!isset($options['highlight'])) {
90-
$options['highlight'] = FALSE;
91-
}
80+
/**
81+
* @var integer
82+
*/
83+
protected $highLowerBound;
9284

93-
if (!isset($options['lowUpperBound'])) {
94-
$options['lowUpperBound'] = 35;
95-
}
85+
/**
86+
* @var boolean
87+
*/
88+
protected $highlight;
9689

97-
if (!isset($options['highLowerBound'])) {
98-
$options['highLowerBound'] = 70;
99-
}
90+
/**
91+
* @var string
92+
*/
93+
protected $title;
10094

101-
if (!isset($options['generator'])) {
102-
$options['generator'] = '';
103-
}
95+
/**
96+
* @var boolean
97+
*/
98+
protected $yui;
10499

105-
$this->options = $options;
100+
/**
101+
* Constructor.
102+
*
103+
* @param array $options
104+
*/
105+
public function __construct($title = '', $charset = 'UTF-8', $yui = TRUE, $highlight = FALSE, $lowUpperBound = 35, $highLowerBound = 70, $generator = '')
106+
{
107+
$this->charset = $charset;
108+
$this->generator = $generator;
109+
$this->highLowerBound = $highLowerBound;
110+
$this->highlight = $highlight;
111+
$this->lowUpperBound = $lowUpperBound;
112+
$this->title = $title;
113+
$this->yui = $yui;
106114

107115
$this->templatePath = sprintf(
108116
'%s%sHTML%sTemplate%s',
@@ -125,31 +133,29 @@ public function process(PHP_CodeCoverage $coverage, $target)
125133
unset($coverage);
126134

127135
$dashboard = new PHP_CodeCoverage_Report_HTML_Dashboard(
128-
$this->templatePath,
129-
$this->options['charset'],
130-
$this->options['generator']
136+
$this->templatePath, $this->charset, $this->generator
131137
);
132138

133139
$directory = new PHP_CodeCoverage_Report_HTML_Directory(
134140
$this->templatePath,
135-
$this->options['charset'],
136-
$this->options['generator'],
137-
$this->options['lowUpperBound'],
138-
$this->options['highLowerBound']
141+
$this->charset,
142+
$this->generator,
143+
$this->lowUpperBound,
144+
$this->highLowerBound
139145
);
140146

141147
$file = new PHP_CodeCoverage_Report_HTML_File(
142148
$this->templatePath,
143-
$this->options['charset'],
144-
$this->options['generator'],
145-
$this->options['lowUpperBound'],
146-
$this->options['highLowerBound'],
147-
$this->options['highlight'],
148-
$this->options['yui']
149+
$this->charset,
150+
$this->generator,
151+
$this->lowUpperBound,
152+
$this->highLowerBound,
153+
$this->highlight,
154+
$this->yui
149155
);
150156

151157
$dashboard->render(
152-
$report, $target . 'index.dashboard.html', $this->options['title']
158+
$report, $target . 'index.dashboard.html', $this->title
153159
);
154160

155161
foreach ($report as $node) {

0 commit comments

Comments
 (0)