forked from sebastianbergmann/phpunit
/
Version.php
75 lines (64 loc) · 1.56 KB
/
Version.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Runner;
use SebastianBergmann\Version as VersionId;
/**
* This class defines the current version of PHPUnit.
*/
class Version
{
private static $pharVersion;
private static $version;
/**
* Returns the current version of PHPUnit.
*
* @return string
*/
public static function id()
{
if (self::$pharVersion !== null) {
return self::$pharVersion;
}
if (self::$version === null) {
$version = new VersionId('6.0.11', dirname(dirname(__DIR__)));
self::$version = $version->getVersion();
}
return self::$version;
}
/**
* @return string
*/
public static function series()
{
if (strpos(self::id(), '-')) {
$version = explode('-', self::id())[0];
} else {
$version = self::id();
}
return implode('.', array_slice(explode('.', $version), 0, 2));
}
/**
* @return string
*/
public static function getVersionString()
{
return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.';
}
/**
* @return string
*/
public static function getReleaseChannel()
{
if (strpos(self::$pharVersion, '-') !== false) {
return '-nightly';
}
return '';
}
}