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.
Completed
Push — master ( fbfcab...4cb748 )
by Steven
06:46 queued 03:41
created

Bootstrap::initAutoloader()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
rs 9.2
cc 3
eloc 12
nc 4
nop 0
1
<?php
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 11 and the first side effect is on line 56.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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();