Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Revision 621 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\Runner;
11
 
12
use function array_slice;
13
use function dirname;
14
use function explode;
15
use function implode;
16
use function strpos;
17
use SebastianBergmann\Version as VersionId;
18
 
19
/**
20
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
21
 */
22
final class Version
23
{
24
    /**
25
     * @var string
26
     */
27
    private static $pharVersion = '';
28
 
29
    /**
30
     * @var string
31
     */
32
    private static $version = '';
33
 
34
    /**
35
     * Returns the current version of PHPUnit.
36
     */
37
    public static function id(): string
38
    {
39
        if (self::$pharVersion !== '') {
40
            return self::$pharVersion;
41
        }
42
 
43
        if (self::$version === '') {
150 lars 44
            self::$version = (new VersionId('9.5.28', dirname(__DIR__, 2)))->getVersion();
148 lars 45
        }
46
 
47
        return self::$version;
48
    }
49
 
50
    public static function series(): string
51
    {
52
        if (strpos(self::id(), '-')) {
53
            $version = explode('-', self::id())[0];
54
        } else {
55
            $version = self::id();
56
        }
57
 
58
        return implode('.', array_slice(explode('.', $version), 0, 2));
59
    }
60
 
61
    public static function getVersionString(): string
62
    {
63
        return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.';
64
    }
65
}