Completed
Push — master ( 3eed6d...7635b2 )
by Sebastian
04:09 queued 01:07
created

Version::getVersionString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace phpbu\App;
3
4
use SebastianBergmann;
5
6
/**
7
 * Application Version.
8
 *
9
 * @package    phpbu
10
 * @subpackage App
11
 * @author     Sebastian Feldmann <[email protected]>
12
 * @copyright  Sebastian Feldmann <[email protected]>
13
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
14
 * @link       http://phpbu.de/
15
 * @since      Class available since Release 1.0.0
16
 */
17
class Version
18
{
19
    /**
20
     * Version of the phar file.
21
     * Is getting set via the phar build process.
22
     *
23
     * @var string
24
     */
25
    private static $pharVersion;
26
27
    /**
28
     * Current version
29
     *
30
     * @var string
31
     */
32
    private static $version;
33
34
    /**
35
     * Return the current version of PHPUnit.
36
     *
37
     * @return string
38
     */
39 2
    public static function id() : string
40
    {
41 2
        if (self::$pharVersion !== null) {
42
            return self::$pharVersion;
43
        }
44
45 2
        if (self::$version === null) {
46 1
            $version = new SebastianBergmann\Version('5.0', dirname(dirname(__DIR__)));
47 1
            self::$version = $version->getVersion();
48
        }
49
50 2
        return self::$version;
51
    }
52
53
    /**
54
     * Return the version string.
55
     *
56
     * @return string
57
     */
58 1
    public static function getVersionString() : string
59
    {
60 1
        return 'phpbu ' . self::id() . ' by Sebastian Feldmann and contributors.';
61
    }
62
}
63