/** * Register rex_autoload in spl autoloader. */ public static function register() { if (self::$registered) { return; } ini_set('unserialize_callback_func', 'spl_autoload_call'); if (!self::$composerLoader) { self::$composerLoader = (require rex_path::core('vendor/autoload.php')); // Unregister Composer Autoloader because we call self::$composerLoader->loadClass() manually self::$composerLoader->unregister(); } if (false === spl_autoload_register([__CLASS__, 'autoload'])) { throw new Exception(sprintf('Unable to register %s::autoload as an autoloading method.', __CLASS__)); } self::$cacheFile = rex_path::cache('autoload.cache'); self::loadCache(); register_shutdown_function([__CLASS__, 'saveCache']); self::$registered = true; }