Skip to content

Commit 04c983b

Browse files
Refactor.
1 parent fcb91d9 commit 04c983b

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

PHP/CodeCoverage/Report/HTML.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function __construct($title = '', $charset = 'UTF-8', $yui = TRUE, $highl
129129
*/
130130
public function process(PHP_CodeCoverage $coverage, $target)
131131
{
132-
$target = PHP_CodeCoverage_Util::getDirectory($target);
132+
$target = $this->getDirectory($target);
133133
$report = $coverage->getReport();
134134
unset($coverage);
135135

@@ -213,4 +213,31 @@ protected function copyFiles($target)
213213
copy($this->templatePath . $file, $target . $file);
214214
}
215215
}
216+
217+
/**
218+
* @param string $directory
219+
* @return string
220+
* @throws PHP_CodeCoverage_Exception
221+
*/
222+
protected function getDirectory($directory)
223+
{
224+
if (substr($directory, -1, 1) != DIRECTORY_SEPARATOR) {
225+
$directory .= DIRECTORY_SEPARATOR;
226+
}
227+
228+
if (is_dir($directory)) {
229+
return $directory;
230+
}
231+
232+
if (mkdir($directory, 0777, TRUE)) {
233+
return $directory;
234+
}
235+
236+
throw new PHP_CodeCoverage_Exception(
237+
sprintf(
238+
'Directory "%s" does not exist.',
239+
$directory
240+
)
241+
);
242+
}
216243
}

PHP/CodeCoverage/Util.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,33 +115,6 @@ public static function crap($ccn, $coverage)
115115
);
116116
}
117117

118-
/**
119-
* @param string $directory
120-
* @return string
121-
* @throws PHP_CodeCoverage_Exception
122-
*/
123-
public static function getDirectory($directory)
124-
{
125-
if (substr($directory, -1, 1) != DIRECTORY_SEPARATOR) {
126-
$directory .= DIRECTORY_SEPARATOR;
127-
}
128-
129-
if (is_dir($directory)) {
130-
return $directory;
131-
}
132-
133-
if (mkdir($directory, 0777, TRUE)) {
134-
return $directory;
135-
}
136-
137-
throw new PHP_CodeCoverage_Exception(
138-
sprintf(
139-
'Directory "%s" does not exist.',
140-
$directory
141-
)
142-
);
143-
}
144-
145118
/**
146119
* Returns the files and lines a test method wants to cover.
147120
*

0 commit comments

Comments
 (0)