22 #require_once dirname(__FILE__) . '/SplAutoloader.php'; 101 #require_once dirname(__FILE__) . '/Exception/InvalidArgumentException.php'; 113 if (is_array($pairs) || $pairs instanceof Traversable) {
118 if (is_array($pairs) || $pairs instanceof Traversable) {
140 $this->fallbackAutoloaderFlag = (bool) $flag;
177 #require_once dirname(__FILE__) . '/Exception/InvalidArgumentException.php'; 181 foreach (
$namespaces as $namespace => $directory) {
210 #require_once dirname(__FILE__) . '/Exception/InvalidArgumentException.php'; 229 if (
false !== strpos(
$class, self::NS_SEPARATOR)) {
237 if (
false !== strpos(
$class, self::PREFIX_SEPARATOR)) {
256 public function register()
258 spl_autoload_register(array($this,
'autoload'));
288 preg_match(
'/(?P<namespace>.+\\\)?(?P<class>[^\\\]+$)/',
$class, $matches);
290 $class = (isset($matches[
'class'])) ? $matches[
'class'] :
'';
291 $namespace = (isset($matches[
'namespace'])) ? $matches[
'namespace'] :
'';
294 . str_replace(self::NS_SEPARATOR,
'/', $namespace)
295 . str_replace(self::PREFIX_SEPARATOR,
'/',
$class)
308 if (!in_array(
$type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) {
309 #require_once dirname(__FILE__) . '/Exception/InvalidArgumentException.php'; 314 if (
$type === self::ACT_AS_FALLBACK) {
317 if (version_compare(PHP_VERSION,
'5.3.2',
'>=')) {
318 $resolvedName = stream_resolve_include_path($filename);
319 if ($resolvedName !==
false) {
320 return include $resolvedName;
324 $this->error =
false;
325 set_error_handler(array($this,
'handleError'), E_WARNING);
327 restore_error_handler();
336 if (0 === strpos(
$class, $leader)) {
338 $trimmedClass = substr(
$class, strlen($leader));
342 if (file_exists($filename)) {
343 return include $filename;
359 $last = $directory[strlen($directory) - 1];
360 if (in_array($last, array(
'/',
'\\'))) {
361 $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;
364 $directory .= DIRECTORY_SEPARATOR;
registerNamespace($namespace, $directory)
normalizeDirectory($directory)
setFallbackAutoloader($flag)
elseif(isset( $params[ 'redirect_parent']))
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
transformClassNameToFilename($class, $directory)
registerNamespaces($namespaces)
$_option $_optionId $class
registerPrefix($prefix, $directory)
handleError($errno, $errstr)
registerPrefixes($prefixes)
__construct($options=null)