/** * @param Report $report * @return string */ public static function formatReportReadable(Report $report) { $message = ''; if ($report instanceof TimestampedReport) { $message .= '[' . $report->getTimestamp()->format(\DateTime::ATOM) . ']'; } if ($report instanceof AnalyzerReport) { $message .= '[' . Severity::toString($report->getAnalyzer()->getSeverity()) . ']'; $message .= '[' . $report->getAnalyzer()->getName() . ']'; } if (!empty($message)) { $message .= ' '; } $message .= $report->report() . PHP_EOL; if (NULL !== ($sourceFragment = $report->getSourceFragment())) { $message .= self::formatSourceFragmentReadable($sourceFragment); } return $message; }
/** * @param Report $report * @return string */ public function formatReport(Report $report) { return json_encode($report->toArray(), $this->options); }
public function toArray() { return ['class' => $this->class->getName(), 'methods' => array_map(function (ParsedMethod $cam) { return $cam->getClass()->getName() . '::' . $cam->getMethod()->name . '()'; }, $this->methods)] + parent::toArray(); }