AfterAnalysisEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Event;
6
7
use Churn\Result\ResultReporter;
8
9
/**
10
 * @internal
11
 */
12
final class AfterAnalysisEvent implements AfterAnalysis
13
{
14
    /**
15
     * @var ResultReporter
16
     */
17
    private $resultReporter;
18
19
    /**
20
     * @param ResultReporter $resultReporter The results report.
21
     */
22
    public function __construct(ResultReporter $resultReporter)
23
    {
24
        $this->resultReporter = $resultReporter;
25
    }
26
27
    /**
28
     * Returns the total number of files analysed.
29
     */
30
    #[\Override]
31
    public function getNumberOfFiles(): int
32
    {
33
        return $this->resultReporter->getNumberOfFiles();
34
    }
35
36
    /**
37
     * Returns the max number of changes among the analysed files.
38
     */
39
    #[\Override]
40
    public function getMaxNumberOfChanges(): int
41
    {
42
        return $this->resultReporter->getMaxCommits();
43
    }
44
45
    /**
46
     * Returns the max cyclomatic complexity among the analysed files.
47
     */
48
    #[\Override]
49
    public function getMaxCyclomaticComplexity(): int
50
    {
51
        return $this->resultReporter->getMaxComplexity();
52
    }
53
54
    /**
55
     * Returns the highest score among the analysed files.
56
     */
57
    #[\Override]
58
    public function getMaxScore(): ?float
59
    {
60
        return $this->resultReporter->getMaxScore();
61
    }
62
}
63