Esempio n. 1
0
 /**
  * @param Result $result
  * @return string
  */
 public function format(Result $result)
 {
     $issues = ResultHelper::sortIssues($result->getIssues());
     $metrics = ResultHelper::sortMetrics($result->getMetrics());
     $markdown = new MarkdownBuilder();
     $markdown->h1(count($issues) . ' Issue(s)');
     foreach (ResultHelper::groupIssues($issues) as $file => $issues) {
         $this->renderSection($markdown, $file, $issues);
     }
     $markdown->h1(count($metrics) . ' Metric(s)');
     foreach ($metrics as $metric) {
         $this->renderMetric($markdown, $metric);
     }
     return $markdown->getMarkdown();
 }
Esempio n. 2
0
 /**
  * @param Result $result
  * @return string
  */
 public function format(Result $result)
 {
     $issues = ResultHelper::sortIssues($result->getIssues());
     $metrics = ResultHelper::sortMetrics($result->getMetrics());
     $markdown = new MarkdownBuilder();
     $markdown->h1(count($issues) . ' Issue(s)');
     $markdown->bulletedList(array_map(function (Issue $issue) {
         return sprintf('%s on line %s: %s', $issue->getFile(), $issue->getLine(), $issue->getTitle());
     }, $issues));
     $metrics = array_filter($metrics, function (Metric $metric) {
         return $metric->getValue() != 0;
     });
     $markdown->h1(count($metrics) . ' Metric(s)');
     $markdown->bulletedList(array_map(function (Metric $metric) {
         return sprintf('[%s] %s: %s', $metric->getCode(), $metric->getTitle(), $metric->getValue());
     }, $metrics));
     return $markdown->getMarkdown();
 }