aboutsummaryrefslogtreecommitdiff
path: root/autoload.php
blob: b9d471b3f3155cf559889b07c14c02204ca8c579 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

declare(strict_types=1);

// Borrowed and modified from PSR-4 Closure Example
spl_autoload_register(
    function ($class) {
        $prefix = 'AugustOffensive\\';
        $relative_class = substr($class, strlen($prefix));

        // find file in /private/ in respective namespace path
        $file = __DIR__ . '/private/' . str_replace('\\', '/', $relative_class) . '.php';

        // if the file exists, require it
        if (file_exists($file)) {
            require $file;
        }
    }
);