示例#1
0
 /**
  * @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;
 }
示例#2
0
文件: Json.php 项目: mfn/php-analyzer
 /**
  * @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();
 }