autoload.php
17 lines
| 1 | <?php |
| 2 | |
| 3 | namespace { |
| 4 | \spl_autoload_register(function ($className) { |
| 5 | $classPath = \explode('\\', $className); |
| 6 | if ($classPath[0] !== 'Davaxi') { |
| 7 | return; |
| 8 | } |
| 9 | // Drop 'Davaxi', and maximum file path depth in this project is 1 |
| 10 | $classPath = \array_slice($classPath, 1, 2); |
| 11 | $filePath = __DIR__ . '/' . \implode('/', $classPath) . '.php'; |
| 12 | if (\file_exists($filePath)) { |
| 13 | require_once $filePath; |
| 14 | } |
| 15 | }); |
| 16 | } |
| 17 |