/** * This method automatically adds <code>spl_autoload_register()</code> to * find and load nonexistent classes. * * Usually, not used by end user. * * @param string name of the class to load * @return null */ public static function load($class) { if (class_exists($class, false)) { return; } foreach (self::$dirs as $d) { if (is_file($f = $d . '/' . $class . '.php') && is_readable($f)) { return require_once $f; } } if (class_exists('AutoloadException', false)) { $ex = new AutoloadException('Class "' . $class . '" not found'); $ex->setExtra('Relative paths', implode(', ', str_replace(self::$rd . '/', '', self::$dirs))); throw $ex; } else { die('Class "' . $class . '" not found' . PHP_EOL . 'Relative paths: ' . implode(', ', str_replace(self::$rd . '/', '', self::$dirs))); } }