2019-05-11 00:07:13 +02:00
|
|
|
<?php
|
2019-06-09 18:37:28 +02:00
|
|
|
namespace Psalm\Report;
|
2019-05-11 00:07:13 +02:00
|
|
|
|
2019-06-26 22:52:29 +02:00
|
|
|
use function json_encode;
|
2019-07-05 22:24:00 +02:00
|
|
|
use Psalm\Report;
|
2019-05-11 00:07:13 +02:00
|
|
|
|
2019-06-09 18:37:28 +02:00
|
|
|
class JsonSummaryReport extends Report
|
2019-05-11 00:07:13 +02:00
|
|
|
{
|
|
|
|
/**
|
2019-07-05 22:24:00 +02:00
|
|
|
* {@inheritdoc}
|
2019-05-11 00:07:13 +02:00
|
|
|
*/
|
|
|
|
public function create(): string
|
|
|
|
{
|
|
|
|
$type_counts = [];
|
|
|
|
|
|
|
|
foreach ($this->issues_data as $issue_data) {
|
2020-02-17 00:24:40 +01:00
|
|
|
$type = $issue_data->type;
|
2019-05-11 00:07:13 +02:00
|
|
|
|
|
|
|
if (!isset($type_counts[$type])) {
|
|
|
|
$type_counts[$type] = 0;
|
|
|
|
}
|
|
|
|
|
2019-07-05 22:24:00 +02:00
|
|
|
++$type_counts[$type];
|
2019-05-11 00:07:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return json_encode([
|
|
|
|
'issue_counts' => $type_counts,
|
|
|
|
'mixed_expression_count' => $this->mixed_expression_count,
|
2019-07-05 22:24:00 +02:00
|
|
|
'total_expression_count' => $this->total_expression_count,
|
2019-05-11 00:07:13 +02:00
|
|
|
]) . "\n";
|
|
|
|
}
|
|
|
|
}
|