PredefinedProcess::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Process;
6
7
use Churn\File\File;
8
9
/**
10
 * @internal
11
 */
12
final class PredefinedProcess implements ChangesCountInterface, CyclomaticComplexityInterface
13
{
14
    /**
15
     * @var File
16
     */
17
    private $file;
18
19
    /**
20
     * @var integer
21
     */
22
    private $countChanges;
23
24
    /**
25
     * @var integer
26
     */
27
    private $cyclomaticComplexity;
28
29
    /**
30
     * @param File $file The file the process is being executed on.
31
     * @param integer $countChanges The number of changes of the file.
32
     * @param integer $cyclomaticComplexity The complexity of the file.
33
     */
34
    public function __construct(File $file, int $countChanges, int $cyclomaticComplexity)
35
    {
36
        $this->file = $file;
37
        $this->countChanges = $countChanges;
38
        $this->cyclomaticComplexity = $cyclomaticComplexity;
39
    }
40
41
    /**
42
     * Start the process.
43
     */
44
    #[\Override]
45
    public function start(): void
46
    {
47
        // nothing to do
48
    }
49
50
    /**
51
     * Determines if the process was successful.
52
     */
53
    #[\Override]
54
    public function isSuccessful(): bool
55
    {
56
        return true;
57
    }
58
59
    /**
60
     * Gets the file the process is being executed on.
61
     */
62
    #[\Override]
63
    public function getFile(): File
64
    {
65
        return $this->file;
66
    }
67
68
    /**
69
     * Returns the number of changes for a file.
70
     */
71
    #[\Override]
72
    public function countChanges(): int
73
    {
74
        return $this->countChanges;
75
    }
76
77
    /**
78
     * Returns the cyclomatic complexity of a file.
79
     */
80
    #[\Override]
81
    public function getCyclomaticComplexity(): int
82
    {
83
        return $this->cyclomaticComplexity;
84
    }
85
}
86