public static function init() { $directoryIterator = new RecursiveDirectoryIterator(__DIR__); $iterator = new RecursiveIteratorIterator($directoryIterator); $dirs = []; foreach ($iterator as $file) { if ($file->isDir()) { $dirs[] = $file->getRealPath(); } } $dirs = array_unique($dirs); self::$dirs = $dirs; }
/** * Registers an array of directories to load from. * * @access public * @static * @param array $files An array of directories to load from */ public static function registerDirectories($dirs) { self::$dirs = array_merge(self::$dirs, $dirs); }
public static function register(array $dirs) { self::$dirs = array_merge(array(__DIR__), $dirs); spl_autoload_register(array('AutoLoader', 'load')); }