Passed
Push — master ( 93e91b...83695f )
by Fabien
02:05
created

AfterAnalysisEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 46
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getNumberOfFiles() 0 3 1
A getMaxScore() 0 3 1
A getMaxCyclomaticComplexity() 0 3 1
A getMaxNumberOfChanges() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Event;
6
7
use Churn\Result\ResultAccumulator;
8
9
/**
10
 * @internal
11
 */
12
final class AfterAnalysisEvent implements AfterAnalysis
13
{
14
15
    /**
16
     * @var ResultAccumulator
17
     */
18
    private $resultAccumulator;
19
20
    /**
21
     * @param ResultAccumulator $resultAccumulator The results report.
22
     */
23
    public function __construct(ResultAccumulator $resultAccumulator)
24
    {
25
        $this->resultAccumulator = $resultAccumulator;
26
    }
27
28
    /**
29
     * Returns the total number of files analysed.
30
     */
31
    public function getNumberOfFiles(): int
32
    {
33
        return $this->resultAccumulator->getNumberOfFiles();
34
    }
35
36
    /**
37
     * Returns the max number of changes among the analysed files.
38
     */
39
    public function getMaxNumberOfChanges(): int
40
    {
41
        return $this->resultAccumulator->getMaxCommits();
42
    }
43
44
    /**
45
     * Returns the max cyclomatic complexity among the analysed files.
46
     */
47
    public function getMaxCyclomaticComplexity(): int
48
    {
49
        return $this->resultAccumulator->getMaxComplexity();
50
    }
51
52
    /**
53
     * Returns the highest score among the analysed files.
54
     */
55
    public function getMaxScore(): ?float
56
    {
57
        return $this->resultAccumulator->getMaxScore();
58
    }
59
}
60