1 <?php
2
3 /**
4 * Handles stuff
5 *
6 * @author Art <a.molcanovas@gmail.com>
7 */
8 abstract class Handler {
9
10 /**
11 * Class/interface/trait autoloader
12 *
13 * @author Art <a.molcanovas@gmail.com>
14 *
15 * @param string $name Class name
16 */
17 static function autoloader($name) {
18 $name = ltrim(strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $name)), '/') . '.php';
19 $locations = [
20 DIR_CORE . 'class',
21 DIR_CORE . 'interface',
22 DIR_CORE . 'trait'
23 ];
24
25 foreach($locations as $l) {
26 if(file_exists($l . DIRECTORY_SEPARATOR . $name)) {
27 include_once $l . DIRECTORY_SEPARATOR . $name;
28 break;
29 }
30 }
31 }
32
33 }