/** * @param Category $category */ public function addReportMetrics(Category $category) { if (!isset($this->reportMetrics[$category->getName()])) { $this->reportMetrics[$category->getName()] = ['valid' => 0, 'invalid' => 0]; } $currentReport =& $this->reportMetrics[$category->getName()]; foreach ($category->getQuestions() as $question) { if ($question->isValid()) { $currentReport['valid']++; } else { $currentReport['invalid']++; } } }