Skip to content

Commit

Permalink
Added PHPLoc ^4 support. (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 authored and mrook committed Jun 19, 2017
1 parent 3f494f2 commit de50c3e
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 173 deletions.
9 changes: 7 additions & 2 deletions classes/phing/tasks/ext/phploc/PHPLocCSVFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class PHPLocCSVFormatter extends AbstractPHPLocFormatter
{
public function printResult(array $count, $countTests = false)
{
$printerClass = '\\SebastianBergmann\\PHPLOC\\Log\\CSV\\Single';
$printer = new $printerClass();
if (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\CSV\\Single')) {
$printer = new SebastianBergmann\PHPLOC\Log\CSV\Single();
} elseif (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\Csv')) {
$printer = new \SebastianBergmann\PHPLOC\Log\Csv();
} else {
throw new BuildException('Not supported PHPLOC version used.');
}
$printer->printResult($this->getToDir() . DIRECTORY_SEPARATOR . $this->getOutfile(), $count);
}
}
9 changes: 7 additions & 2 deletions classes/phing/tasks/ext/phploc/PHPLocXMLFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class PHPLocXMLFormatter extends AbstractPHPLocFormatter
{
public function printResult(array $count, $countTests = false)
{
$printerClass = '\\SebastianBergmann\\PHPLOC\\Log\\XML';
$printer = new $printerClass();
if (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\XML')) {
$printer = new SebastianBergmann\PHPLOC\Log\XML();
} elseif (class_exists('\\SebastianBergmann\\PHPLOC\\Log\\Xml')) {
$printer = new SebastianBergmann\PHPLOC\Log\Xml();
} else {
throw new BuildException('Not supported PHPLOC version used.');
}
$printer->printResult($this->getToDir() . DIRECTORY_SEPARATOR . $this->getOutfile(), $count);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"pear/versioncontrol_svn": "~0.5",
"pdepend/pdepend": "2.x",
"phpdocumentor/phpdocumentor": "2.x",
"phploc/phploc": "^3.0",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "~2.2",
"phpunit/phpunit": ">=5.4",
"siad007/versioncontrol_hg": "^1.0",
Expand Down
Loading

0 comments on commit de50c3e

Please sign in to comment.