Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
Version | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
__construct | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
compare | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\Version |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\Version; |
16 | |
17 | /** |
18 | * Version class. |
19 | * |
20 | * Responsible for handling versions |
21 | * |
22 | * @package phpOMS\Version |
23 | * @license OMS License 2.0 |
24 | * @link https://jingga.app |
25 | * @since 1.0.0 |
26 | */ |
27 | final class Version |
28 | { |
29 | /** |
30 | * Constructor. |
31 | * |
32 | * @since 1.0.0 |
33 | * @codeCoverageIgnore |
34 | */ |
35 | private function __construct() |
36 | { |
37 | } |
38 | |
39 | /** |
40 | * Comparing two versions. |
41 | * |
42 | * @param string $ver1 Version |
43 | * @param string $ver2 Version |
44 | * |
45 | * @return int Returns the version comparison (0 = equals; -1 = lower; 1 = higher) |
46 | * |
47 | * @since 1.0.0 |
48 | */ |
49 | public static function compare(string $ver1, string $ver2) : int |
50 | { |
51 | return \version_compare($ver1, $ver2); |
52 | } |
53 | } |