コード例 #1
0
 /**
  * @param MarkdownBuilder $markdown
  * @param Metric $metric
  */
 protected function renderMetric(MarkdownBuilder $markdown, Metric $metric)
 {
     $markdown->h2($metric->getTitle());
     if ($metric->getDescription()) {
         $markdown->p($metric->getDescription());
     }
     $markdown->bulletedList(['code: ' . $metric->getCode(), 'value: ' . $metric->getValue()]);
 }
コード例 #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();
 }