Report   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 96
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 27 2
create() 0 1 ?
1
<?php
2
namespace Psalm;
3
4
use function array_filter;
5
use Psalm\Internal\Analyzer\IssueData;
6
7
abstract class Report
8
{
9
    const TYPE_COMPACT = 'compact';
10
    const TYPE_CONSOLE = 'console';
11
    const TYPE_PYLINT = 'pylint';
12
    const TYPE_JSON = 'json';
13
    const TYPE_JSON_SUMMARY = 'json-summary';
14
    const TYPE_SONARQUBE = 'sonarqube';
15
    const TYPE_EMACS = 'emacs';
16
    const TYPE_XML = 'xml';
17
    const TYPE_JUNIT = 'junit';
18
    const TYPE_CHECKSTYLE = 'checkstyle';
19
    const TYPE_TEXT = 'text';
20
    const TYPE_GITHUB_ACTIONS = 'github';
21
22
    const SUPPORTED_OUTPUT_TYPES = [
23
        self::TYPE_COMPACT,
24
        self::TYPE_CONSOLE,
25
        self::TYPE_PYLINT,
26
        self::TYPE_JSON,
27
        self::TYPE_JSON_SUMMARY,
28
        self::TYPE_SONARQUBE,
29
        self::TYPE_EMACS,
30
        self::TYPE_XML,
31
        self::TYPE_JUNIT,
32
        self::TYPE_CHECKSTYLE,
33
        self::TYPE_TEXT,
34
        self::TYPE_GITHUB_ACTIONS,
35
    ];
36
37
    /**
38
     * @var array<int, IssueData>
39
     */
40
    protected $issues_data;
41
42
    /** @var array<string, int> */
43
    protected $fixable_issue_counts;
44
45
    /** @var bool */
46
    protected $use_color;
47
48
    /** @var bool */
49
    protected $show_snippet;
50
51
    /** @var bool */
52
    protected $show_info;
53
54
    /** @var bool */
55
    protected $pretty;
56
57
    /** @var int */
58
    protected $mixed_expression_count;
59
60
    /** @var int */
61
    protected $total_expression_count;
62
63
    /**
64
     * @param array<int, IssueData> $issues_data
65
     * @param array<string, int> $fixable_issue_counts
66
     * @param bool $use_color
0 ignored issues
show
Bug introduced by
There is no parameter named $use_color. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
67
     * @param bool $show_snippet
0 ignored issues
show
Bug introduced by
There is no parameter named $show_snippet. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
68
     * @param bool $show_info
0 ignored issues
show
Bug introduced by
There is no parameter named $show_info. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
69
     */
70
    public function __construct(
71
        array $issues_data,
72
        array $fixable_issue_counts,
73
        Report\ReportOptions $report_options,
74
        int $mixed_expression_count = 1,
75
        int $total_expression_count = 1
76
    ) {
77
        if (!$report_options->show_info) {
78
            $this->issues_data = array_filter(
79
                $issues_data,
80
                function ($issue_data) : bool {
81
                    return $issue_data->severity !== Config::REPORT_INFO;
82
                }
83
            );
84
        } else {
85
            $this->issues_data = $issues_data;
86
        }
87
        $this->fixable_issue_counts = $fixable_issue_counts;
88
89
        $this->use_color = $report_options->use_color;
90
        $this->show_snippet = $report_options->show_snippet;
91
        $this->show_info = $report_options->show_info;
92
        $this->pretty = $report_options->pretty;
93
94
        $this->mixed_expression_count = $mixed_expression_count;
95
        $this->total_expression_count = $total_expression_count;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    abstract public function create(): string;
102
}
103