1 | <?php |
||
23 | final class Version |
||
24 | { |
||
25 | /** @var string */ |
||
26 | private $build; |
||
27 | /** @var int */ |
||
28 | private $major; |
||
29 | /** @var int */ |
||
30 | private $minor; |
||
31 | /** @var int */ |
||
32 | private $patch; |
||
33 | /** @var string */ |
||
34 | private $preRelease; |
||
35 | |||
36 | /** |
||
37 | * @param int $major |
||
38 | * @param int $minor |
||
39 | * @param int $patch |
||
40 | * @param string $preRelease |
||
41 | * @param string $build |
||
42 | * |
||
43 | * @throws \SemVer\SemVer\Exception\InvalidArgumentException |
||
44 | */ |
||
45 | public function __construct(int $major, int $minor, int $patch, string $preRelease = '', string $build = '') |
||
65 | |||
66 | /** @return string */ |
||
67 | public function __toString() : string |
||
79 | |||
80 | /** |
||
81 | * @param string $version |
||
82 | * |
||
83 | * @throws InvalidArgumentException |
||
84 | * |
||
85 | * @return Version |
||
86 | */ |
||
87 | public static function fromString(string $version) : Version |
||
108 | |||
109 | /** |
||
110 | * @return int |
||
111 | */ |
||
112 | public function getMajor() : int |
||
116 | |||
117 | /** |
||
118 | * @return int |
||
119 | */ |
||
120 | public function getMinor() : int |
||
124 | |||
125 | /** |
||
126 | * @return int |
||
127 | */ |
||
128 | public function getPatch() : int |
||
132 | |||
133 | /** |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getPreRelease() : string |
||
140 | |||
141 | /** |
||
142 | * @return string |
||
143 | */ |
||
144 | public function getBuild() : string |
||
148 | |||
149 | /** |
||
150 | * @param Version $other |
||
151 | * |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function equals(Version $other) : bool |
||
158 | |||
159 | /** |
||
160 | * @param Version $other |
||
161 | * |
||
162 | * @return bool |
||
163 | */ |
||
164 | public function greaterThan(Version $other) : bool |
||
168 | |||
169 | /** |
||
170 | * @param Version $other |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | public function greaterThanOrEqual(Version $other) : bool |
||
178 | |||
179 | /** |
||
180 | * @param Version $other |
||
181 | * |
||
182 | * @return bool |
||
183 | */ |
||
184 | public function lessThan(Version $other) : bool |
||
188 | |||
189 | /** |
||
190 | * @param Version $other |
||
191 | * |
||
192 | * @return bool |
||
193 | */ |
||
194 | public function lessThanOrEqual(Version $other) : bool |
||
198 | } |
||
199 |