Completed
Branch master (c5ceed)
by Tomáš
33:54 queued 13:17
created

VendorDirProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A provide() 0 11 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\SniffFinder\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 6
    public static function provide() : string
21
    {
22 6
        if (self::$vendorDir) {
23 5
            return self::$vendorDir;
24
        }
25
26 1
        $classLoaderReflection = new ReflectionClass(ClassLoader::class);
27 1
        self::$vendorDir = dirname(dirname($classLoaderReflection->getFileName()));
28
29 1
        return self::$vendorDir;
30
    }
31
}
32