Passed
Pull Request — master (#260)
by Fabien
01:58
created

NoVcsChangesCountProcess::__construct()   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 1
1
<?php declare(strict_types = 1);
2
3
namespace Churn\Process\ChangesCount;
4
5
use Churn\File\File;
6
use Churn\Process\ChangesCountInterface;
7
8
class NoVcsChangesCountProcess implements ChangesCountInterface
9
{
10
    /**
11
     * The file the process will be executed on.
12
     * @var File
13
     */
14
    private $file;
15
16
    /**
17
     * Class constructor.
18
     * @param File $file The file the process is being executed on.
19
     */
20
    public function __construct(File $file)
21
    {
22
        $this->file = $file;
23
    }
24
25
    /**
26
     * Returns the number of changes for a file.
27
     * @return integer
28
     */
29
    public function countChanges(): int
30
    {
31
        return 1;
32
    }
33
34
    /**
35
     * Start the process.
36
     * @return void
37
     */
38
    public function start(): void
39
    {
40
    }
41
42
    /**
43
     * Determines if the process was successful.
44
     * @return boolean
45
     * @throws ProcessFailedException If the process failed.
46
     */
47
    public function isSuccessful(): bool
48
    {
49
        return true;
50
    }
51
52
    /**
53
     * Gets the file name of the file the process
54
     * is being executed on.
55
     * @return string
56
     */
57
    public function getFilename(): string
58
    {
59
        return $this->file->getDisplayPath();
60
    }
61
62
    /**
63
     * Gets the file the process is being executed on.
64
     * @return File
65
     */
66
    public function getFile(): File
67
    {
68
        return $this->file;
69
    }
70
}
71