/** * Register the PEAR2 autoload class with spl_autoload_register * * @return void */ protected static function register() { if (!self::$registered) { // set up __autoload $autoload = spl_autoload_functions(); spl_autoload_register('PEAR2\\Autoload::load'); if (function_exists('__autoload') && $autoload === false) { // __autoload() was being used, but now would be ignored, add // it to the autoload stack spl_autoload_register('__autoload'); } } self::$registered = true; }
/** * Add a classname-to-file map * * @param string $mapfile The filename of the classmap * * @return void */ protected static function addMap($mapfile) { if (!in_array($mapfile, self::$maps)) { // keep track of specific map file loaded in this // instance so we can update it if necessary self::$mapfile = $mapfile; if (file_exists($mapfile)) { $map = (include $mapfile); if (is_array($map)) { // mapfile contains a valid map, so we'll keep it self::$maps[] = $mapfile; self::$map = array_merge(self::$map, $map); } } } }