|
17 | 17 | class Version |
18 | 18 | { |
19 | 19 | /** |
20 | | - * Version of the phar file. |
21 | | - * Is getting set via the phar build process. |
| 20 | + * Current version |
22 | 21 | * |
23 | 22 | * @var string |
24 | 23 | */ |
25 | | - private static $pharVersion; |
| 24 | + private static $version; |
26 | 25 |
|
27 | 26 | /** |
28 | | - * Current version |
| 27 | + * Path to application root directory. |
29 | 28 | * |
30 | 29 | * @var string |
31 | 30 | */ |
32 | | - private static $version; |
| 31 | + private $path; |
33 | 32 |
|
34 | 33 | /** |
35 | | - * Return the current version of PHPUnit. |
| 34 | + * Current release version. |
| 35 | + * |
| 36 | + * @var string |
| 37 | + */ |
| 38 | + private $release; |
| 39 | + |
| 40 | + /** |
| 41 | + * Current version number. |
| 42 | + * |
| 43 | + * @var string |
| 44 | + */ |
| 45 | + private $number; |
| 46 | + |
| 47 | + /** |
| 48 | + * @param string $release |
| 49 | + * @param string $path |
| 50 | + */ |
| 51 | + public function __construct($release, $path) |
| 52 | + { |
| 53 | + $this->release = $release; |
| 54 | + $this->path = $path; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Return the full version number. |
36 | 59 | * |
37 | 60 | * @return string |
38 | 61 | */ |
39 | | - public static function id() : string |
| 62 | + public function getVersionNumber() |
40 | 63 | { |
41 | | - if (self::$pharVersion !== null) { |
42 | | - return self::$pharVersion; |
| 64 | + if ($this->number === null) { |
| 65 | + if (count(explode('.', $this->release)) == 3) { |
| 66 | + $this->number = $this->release; |
| 67 | + } else { |
| 68 | + $this->number = $this->release . '-dev'; |
| 69 | + } |
43 | 70 | } |
| 71 | + return $this->number; |
| 72 | + } |
44 | 73 |
|
| 74 | + /** |
| 75 | + * Return the current version of PHPUnit. |
| 76 | + * |
| 77 | + * @return string |
| 78 | + */ |
| 79 | + public static function id() : string |
| 80 | + { |
45 | 81 | if (self::$version === null) { |
46 | | - $version = new SebastianBergmann\Version('5.1.2', dirname(dirname(__DIR__))); |
47 | | - self::$version = $version->getVersion(); |
| 82 | + $version = new self('5.1.3', dirname(dirname(__DIR__))); |
| 83 | + self::$version = $version->getVersionNumber(); |
48 | 84 | } |
49 | 85 |
|
50 | 86 | return self::$version; |
|
0 commit comments