GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Version::getMajor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 0
cts 2
cp 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Deployer\Component\PharUpdate\Version;
6
7
/**
8
 * Stores and returns the version information.
9
 *
10
 * @author Kevin Herrera <[email protected]>
11
 */
12
class Version
13
{
14
    /**
15
     * The build metadata identifiers.
16
     *
17
     * @var array
18
     */
19
    protected $build;
20
21
    /**
22
     * The major version number.
23
     *
24
     * @var integer
25
     */
26
    protected $major;
27
28
    /**
29
     * The minor version number.
30
     *
31
     * @var integer
32
     */
33
    protected $minor;
34
35
    /**
36
     * The patch version number.
37
     *
38
     * @var integer
39
     */
40
    protected $patch;
41
42
    /**
43
     * The pre-release version identifiers.
44
     *
45
     * @var array
46
     */
47
    protected $preRelease;
48
49
    /**
50
     * Sets the version information.
51
     *
52
     * @param int $major The major version number.
53
     * @param int $minor The minor version number.
54
     * @param int $patch The patch version number.
55
     * @param array   $pre   The pre-release version identifiers.
56
     * @param array   $build The build metadata identifiers.
57
     */
58
    public function __construct(
59
        int $major = 0,
60
        int $minor = 0,
61
        int $patch = 0,
62
        array $pre = [],
63
        array $build = [],
64
    ) {
65
        $this->build = $build;
66
        $this->major = $major;
67
        $this->minor = $minor;
68
        $this->patch = $patch;
69
        $this->preRelease = $pre;
70
    }
71
72
    /**
73
     * Returns the build metadata identifiers.
74
     *
75
     * @return array The build metadata identifiers.
76
     */
77
    public function getBuild(): array
78
    {
79
        return $this->build;
80
    }
81
82
    /**
83
     * Returns the major version number.
84
     *
85
     * @return int The major version number.
86
     */
87
    public function getMajor(): int
88
    {
89
        return $this->major;
90
    }
91
92
    /**
93
     * Returns the minor version number.
94
     *
95
     * @return int The minor version number.
96
     */
97
    public function getMinor(): int
98
    {
99
        return $this->minor;
100
    }
101
102
    /**
103
     * Returns the patch version number.
104
     *
105
     * @return int The patch version number.
106
     */
107
    public function getPatch(): int
108
    {
109
        return $this->patch;
110
    }
111
112
    /**
113
     * Returns the pre-release version identifiers.
114
     *
115
     * @return array The pre-release version identifiers.
116
     */
117
    public function getPreRelease(): array
118
    {
119
        return $this->preRelease;
120
    }
121
122
    /**
123
     * Checks if the version number is stable.
124
     *
125
     * @return boolean TRUE if it is stable, FALSE if not.
126
     */
127
    public function isStable(): bool
128
    {
129
        return empty($this->preRelease) && $this->major !== 0;
130
    }
131
132
    /**
133
     * Returns string representation.
134
     *
135
     * @return string The string representation.
136
     */
137
    public function __toString(): string
138
    {
139
        return Dumper::toString($this);
140
    }
141
}
142