/** * Determines the PHPMD error score of an analysis. The score is the sum of all the error priorities reported * in the analysis. * * @param Analysis $analysis * * @return int */ protected function getAnalysisScore(Analysis $analysis) { $score = 0; foreach ($analysis->getPHPMDResults()->getErrors() as $file) { foreach ($file as $violation) { $score += (int) $violation['priority']; } } return $score; }