aboutsummaryrefslogtreecommitdiff
path: root/src/bdrem/Autoloader.php
blob: 093b1b0bc874d4c5985031ec5987b805dcbb679b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
namespace bdrem;

class Autoloader
{
    public function load($class)
    {
        $file = strtr($class, '_\\', '//') . '.php';
        if (stream_resolve_include_path($file)) {
            require $file;
        }
    }

    public static function register()
    {
        set_include_path(
            get_include_path() . PATH_SEPARATOR . __DIR__ . '/../'
        );
        spl_autoload_register(array(new self(), 'load'));
    }
}
?>