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

AfterFileAnalysisEvent::getResult()   A

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 0
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\Result;
8
9
/**
10
 * @internal
11
 */
12
final class AfterFileAnalysisEvent implements AfterFileAnalysis
13
{
14
15
    /**
16
     * @var Result
17
     */
18
    private $result;
19
20
    /**
21
     * @param Result $result The result for a file.
22
     */
23
    public function __construct(Result $result)
24
    {
25
        $this->result = $result;
26
    }
27
28
    /**
29
     * Returns the result for a file.
30
     */
31
    public function getResult(): Result
32
    {
33
        return $this->result;
34
    }
35
36
    /**
37
     * Returns the absolute path of the file.
38
     */
39
    public function getFilePath(): string
40
    {
41
        return $this->result->getFile()->getFullPath();
42
    }
43
44
    /**
45
     * Returns the number of times the file has been changed.
46
     */
47
    public function getNumberOfChanges(): int
48
    {
49
        return $this->result->getCommits();
50
    }
51
52
    /**
53
     * Returns the cyclomatic complexity of the file.
54
     */
55
    public function getCyclomaticComplexity(): int
56
    {
57
        return $this->result->getComplexity();
58
    }
59
}
60