summaryrefslogtreecommitdiffstats
path: root/library/vendor/Psr/Loader.php
blob: 45c78af07b04e7339b692ebb91e583e162d311af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/* Icinga Web 2 Elasticsearch Module (c) 2017 Icinga Development Team | GPLv2+ */

spl_autoload_register(function ($class) {
    $prefix = 'Psr\\';
    $len = strlen($prefix);

    $baseDir = __DIR__ . '/';

    if (strncmp($prefix, $class, $len) !== 0) {
        return;
    }

    $relative = substr($class, $len);

    $file = $baseDir . str_replace('\\', '/', $relative) . '.php';

    if (file_exists($file)) {
        require $file;
    }
});