34 lines
847 B
PHP
34 lines
847 B
PHP
<?php
|
|
|
|
class Autoloader
|
|
{
|
|
// autoloader map
|
|
public const MAP = [
|
|
// 'Class' => 'path/to/class.php',
|
|
|
|
// server-level classes
|
|
'App' => SERVER.'/app/App.php',
|
|
'Database' => SERVER.'/app/Database.php',
|
|
'Request' => SERVER.'/app/Request.php',
|
|
'Auth' => SERVER.'/app/Auth.php',
|
|
|
|
// modules
|
|
'HomeModule' => SERVER.'/modules/HomeModule.php',
|
|
'InstallModule' => SERVER.'/modules/InstallModule.php',
|
|
'GateModule' => SERVER.'/modules/GateModule.php',
|
|
|
|
// models
|
|
'Classes' => SERVER.'/models/Classes.php',
|
|
'Player' => SERVER.'/models/Player.php',
|
|
'Spell' => SERVER.'/models/Spell.php',
|
|
'Session' => SERVER.'/models/Session.php',
|
|
];
|
|
|
|
// autoloader
|
|
public static function boot(): void
|
|
{
|
|
spl_autoload_register(function($class) {
|
|
if (isset(self::MAP[$class])) require_once self::MAP[$class];
|
|
});
|
|
}
|
|
} |