Passed
Push — master ( 1f8075...93e91b )
by Fabien
02:17
created

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