Completed
Pull Request — master (#118)
by Marco
01:39
created

Versions::getVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PackageVersions;
6
7
use OutOfBoundsException;
8
use UnexpectedValueException;
9
10
/**
11
 * This is a stub class: it is in place only for scenarios where PackageVersions
12
 * is installed with a `--no-scripts` flag, in which scenarios the Versions class
13
 * is not being replaced.
14
 *
15
 * If you are reading this docBlock inside your `vendor/` dir, then this means
16
 * that PackageVersions didn't correctly install, and is in "fallback" mode.
17
 */
18
final class Versions
19
{
20
    public const ROOT_PACKAGE_NAME = FallbackVersions::ROOT_PACKAGE_NAME;
21
    public const VERSIONS          = [];
22
23
    private function __construct()
24
    {
25
    }
26
27
    /**
28
     * @throws OutOfBoundsException if a version cannot be located.
29
     * @throws UnexpectedValueException if the composer.lock file could not be located.
30
     */
31
    public static function getVersion(string $packageName) : string
32
    {
33
        return FallbackVersions::getVersion($packageName);
34
    }
35
}
36