Initial commit
This commit is contained in:
commit
c8acf0604b
7 files changed
+1179
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Loader controller.
|
||||
*
|
||||
* @author Ivan Filipov <ivan@web-lab.solutions>
|
||||
*
|
||||
* @version 1.0
|
||||
* @date updated Jan 26, 2023
|
||||
*/
|
||||
|
||||
namespace wlurep;
|
||||
|
||||
class Loader {
|
||||
|
||||
private static $defaultNamespace = 'wlurep';
|
||||
|
||||
private function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public static function registerAutoLoad() {
|
||||
spl_autoload_register(array('\wlurep\Loader', 'autoload'));
|
||||
}
|
||||
|
||||
public static function autoload($class) {
|
||||
self::loadClass($class);
|
||||
}
|
||||
|
||||
public static function loadClass($class) {
|
||||
$file = realpath(substr_replace(str_replace('\\', DIRECTORY_SEPARATOR, $class), WL_UREP_PATH, 0, strlen(self::$defaultNamespace)) . '.php');
|
||||
|
||||
if ($file && is_readable($file)) {
|
||||
include $file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user