Skip to content

Commit

Permalink
- Merge [1283].
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 3, 2007
1 parent 7e48b05 commit c7087aa
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion PHPUnit/Util/Log/PMD.php
Expand Up @@ -109,6 +109,7 @@ public function process(PHPUnit_Framework_TestResult $result)
foreach ($fileMetrics->getClasses() as $className => $classMetrics) {
if (!$classMetrics->getClass()->isInterface()) {
$classStartLine = $classMetrics->getClass()->getStartLine();
$classEndLine = $classMetrics->getClass()->getEndLine();

$dit = $classMetrics->getDIT();

Expand All @@ -124,6 +125,7 @@ public function process(PHPUnit_Framework_TestResult $result)
$xmlFile,
'DepthOfInheritanceTree',
$classStartLine,
$classEndLine,
'',
$className
);
Expand All @@ -147,6 +149,7 @@ public function process(PHPUnit_Framework_TestResult $result)
$xmlFile,
'ExcessiveClassLength',
$classStartLine,
$classEndLine,
'',
$className
);
Expand All @@ -172,6 +175,7 @@ public function process(PHPUnit_Framework_TestResult $result)
$xmlFile,
'TooManyFields',
$classStartLine,
$classEndLine,
'',
$className
);
Expand All @@ -197,6 +201,7 @@ public function process(PHPUnit_Framework_TestResult $result)
$xmlFile,
'ExcessivePublicCount',
$classStartLine,
$classEndLine,
'',
$className
);
Expand Down Expand Up @@ -230,12 +235,13 @@ public function process(PHPUnit_Framework_TestResult $result)
* @param DOMElement $element
* @param string $rule
* @param integer $line
* @param integer $toLine
* @param string $package
* @param string $class
* @param string $method
* @access public
*/
protected function addViolation($violation, DOMElement $element, $rule, $line = '', $package = '', $class = '', $method = '', $function = '')
protected function addViolation($violation, DOMElement $element, $rule, $line = '', $toLine = '', $package = '', $class = '', $method = '', $function = '')
{
$violationXml = $element->appendChild(
$element->ownerDocument->createElement('violation', $violation)
Expand All @@ -247,6 +253,10 @@ protected function addViolation($violation, DOMElement $element, $rule, $line =
$violationXml->setAttribute('line', $line);
}

if (!empty($toLine)) {
$violationXml->setAttribute('to-line', $toLine);
}

if (empty($package)) {
$package = 'global';
}
Expand Down Expand Up @@ -277,6 +287,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
}

$startLine = $metrics->getFunction()->getStartLine();
$endLine = $metrics->getFunction()->getEndLine();
$name = $metrics->getFunction()->getName();

$ccn = $metrics->getCCN();
Expand All @@ -298,6 +309,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
$element,
'CyclomaticComplexity',
$startLine,
$endLine,
'',
$scope,
$name
Expand All @@ -323,6 +335,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
$element,
'NPathComplexity',
$startLine,
$endLine,
'',
$scope,
$name
Expand Down Expand Up @@ -359,6 +372,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
$element,
'CodeCoverage',
$startLine,
$endLine,
'',
$scope,
$name
Expand All @@ -381,6 +395,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
$element,
'ExcessiveMethodLength',
$startLine,
$endLine,
'',
$scope,
$name
Expand All @@ -403,6 +418,7 @@ protected function processFunctionOrMethod(DOMElement $element, $metrics)
$element,
'ExcessiveParameterList',
$startLine,
$endLine,
'',
$scope,
$name
Expand Down

0 comments on commit c7087aa

Please sign in to comment.