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

VendorDirProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 17
ccs 3
cts 5
cp 0.6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A provide() 0 9 2
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