Completed
Push — master ( 23bc19...2eec4d )
by Tomáš
11:42
created

VendorDirProvider::provide()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.2559

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 3
cts 5
cp 0.6
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2.2559
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\PHP7_CodeSniffer\Composer;
9
10
use Composer\Autoload\ClassLoader;
11
use ReflectionClass;
12
13
final class VendorDirProvider
14
{
15
    /**
16
     * @var string
17
     */
18
    private static $vendorDir;
19
20 19
    public static function provide() : string
21
    {
22 19
        if (self::$vendorDir) {
23 19
            return self::$vendorDir;
24
        }
25
26
        $classLoaderReflection = new ReflectionClass(ClassLoader::class);
27
        return self::$vendorDir = dirname(dirname($classLoaderReflection->getFileName()));
28
    }
29
}
30