Result::getResultCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace YamlStandards\Result;
6
7
class Result
8
{
9
    public const
10
        RESULT_CODE_OK = 0.0,
11
        RESULT_CODE_FIXED_INVALID_FILE_SYNTAX = 0.1,
12
        RESULT_CODE_INVALID_FILE_SYNTAX = 1.0,
13
        RESULT_CODE_GENERAL_ERROR = 2.0;
14
    public const RESULT_CODE_OK_AS_INTEGER = 0;
15
16
    /**
17
     * @var string
18
     */
19
    private $pathToFile;
20
21
    /**
22
     * @var float
23
     */
24
    private $resultCode;
25
26
    /**
27
     * @var string|null
28
     */
29
    private $message;
30
31
    /**
32
     * @var bool
33
     */
34
    private $canBeFixedByFixer;
35
36
    /**
37
     * @param string $pathToFile
38
     * @param float $resultCode
39
     * @param string|null $message
40
     * @param bool $canBeFixedByFixer
41
     */
42 36
    public function __construct(
43
        string $pathToFile,
44
        float $resultCode,
45
        ?string $message = null,
46
        bool $canBeFixedByFixer = false
47
    ) {
48 36
        $this->pathToFile = $pathToFile;
49 36
        $this->resultCode = $resultCode;
50 36
        $this->message = $message;
51 36
        $this->canBeFixedByFixer = $canBeFixedByFixer;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getPathToFile(): string
58
    {
59
        return $this->pathToFile;
60
    }
61
62
    /**
63
     * @return float
64
     */
65 26
    public function getResultCode(): float
66
    {
67 26
        return $this->resultCode;
68
    }
69
70
    /**
71
     * @return string|null
72
     */
73
    public function getMessage(): ?string
74
    {
75
        return $this->message;
76
    }
77
78
    /**
79
     * @return bool
80
     */
81
    public function canBeFixedByFixer(): bool
82
    {
83
        return $this->canBeFixedByFixer;
84
    }
85
}
86