/** * @param ReportComposerInterface $report * @return array */ protected function getFormattedRows(ReportComposerInterface $report) { $rows = $report->getReportHeader()->getRows(); $output = []; if (count($rows)) { foreach ($rows as $rowId => $row) { $output[$rowId] = []; foreach ($row as $column) { $output[$rowId][$column->getKey()] = $column->getContent(); } } } return ['violations' => $output, 'created' => $report->getReportHeader()->getCreated()->format('Y-m-d H:i:s')]; }
/** * @param ReportComposerInterface $report * @return string */ public function serialize(ReportComposerInterface $report) { $rows = $this->getRows($report->getReportHeader()->getRows()); $html = $this->engine->loadTemplate(file_get_contents(__DIR__ . '/../../../../../assets/templates/report.mustache'))->render(['rows' => $rows]); return $html; }
/** * @param ReportComposerInterface $report * @return string */ private function getFooter(ReportComposerInterface $report) { return sprintf("Found a total of %s commits, skipped %s and analyzed %s of them.\n" . "The total violations score was %s", $report->getReport()->getProvider()->countTotal(), $report->getReport()->getProvider()->countSkipped(), $report->getReport()->getProvider()->countAnalyzed(), $report->getReport()->getScore()); }