AfterFileAnalysisEvent::getFilePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Event;
6
7
use Churn\Result\ResultInterface;
8
9
/**
10
 * @internal
11
 */
12
final class AfterFileAnalysisEvent implements AfterFileAnalysis
13
{
14
    /**
15
     * @var ResultInterface
16
     */
17
    private $result;
18
19
    /**
20
     * @param ResultInterface $result The result for a file.
21
     */
22
    public function __construct(ResultInterface $result)
23
    {
24
        $this->result = $result;
25
    }
26
27
    /**
28
     * Returns the result for a file.
29
     */
30
    public function getResult(): ResultInterface
31
    {
32
        return $this->result;
33
    }
34
35
    /**
36
     * Returns the absolute path of the file.
37
     */
38
    #[\Override]
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
    #[\Override]
48
    public function getNumberOfChanges(): int
49
    {
50
        return $this->result->getCommits();
51
    }
52
53
    /**
54
     * Returns the cyclomatic complexity of the file.
55
     */
56
    #[\Override]
57
    public function getCyclomaticComplexity(): int
58
    {
59
        return $this->result->getComplexity();
60
    }
61
}
62