Files
plugin-wl-urep/Loader.php
T
2023-04-10 13:51:00 +03:00

39 lines
729 B
PHP

<?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;
}
}
}