GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Bootstrap   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 44
ccs 0
cts 28
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 3 1
A initAutoloader() 0 22 3
A findParentPath() 0 13 3
1
<?php
2
3
namespace HtpasswdManager;
4
5
use Zend\Loader\AutoloaderFactory;
6
use RuntimeException;
7
8
/**
9
 * Test bootstrap, for setting up autoloading
10
 */
11
class Bootstrap {
12
    protected static $serviceManager;
13
14
    public static function init() {
15
        static::initAutoloader();
16
    }
17
18
    protected static function initAutoloader() {
19
        $vendorPath = static::findParentPath('vendor');
20
21
        if (file_exists($vendorPath . '/autoload.php')) {
22
            include $vendorPath . '/autoload.php';
23
        }
24
25
        if (!class_exists('Zend\Loader\AutoloaderFactory')) {
26
            throw new RuntimeException(
27
                'Unable to load ZF2. Run `php composer.phar install`'
28
            );
29
        }
30
31
        AutoloaderFactory::factory(array(
32
            'Zend\Loader\StandardAutoloader' => array(
33
                'autoregister_zf' => true,
34
                'namespaces'      => array(
35
                    __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__,
36
                ),
37
            ),
38
        ));
39
    }
40
41
    protected static function findParentPath($path) {
42
        $dir         = __DIR__;
43
        $previousDir = '.';
44
        while (!is_dir($dir . '/' . $path)) {
45
            $dir = dirname($dir);
46
            if ($previousDir === $dir) {
47
                return false;
48
            }
49
            $previousDir = $dir;
50
        }
51
52
        return $dir . '/' . $path;
53
    }
54
}
55
56
Bootstrap::init();