refactoring the auto-loader.
This commit is contained in:
parent
67ef4ea865
commit
07d6ed5703
|
@ -47,15 +47,9 @@ public static function load($class)
|
||||||
{
|
{
|
||||||
$file = strtolower(str_replace('\\', '/', $class));
|
$file = strtolower(str_replace('\\', '/', $class));
|
||||||
|
|
||||||
if (array_key_exists($class, static::$aliases))
|
if (array_key_exists($class, static::$aliases)) return class_alias(static::$aliases[$class], $class);
|
||||||
{
|
|
||||||
return class_alias(static::$aliases[$class], $class);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! static::load_from_registered($file))
|
( ! static::load_from_registered($file)) or static::load_from_module($file);
|
||||||
{
|
|
||||||
static::load_from_module($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,10 +98,7 @@ private static function load_from_module($file)
|
||||||
|
|
||||||
foreach (array($module.'models', $module.'libraries') as $directory)
|
foreach (array($module.'models', $module.'libraries') as $directory)
|
||||||
{
|
{
|
||||||
if (file_exists($path = $directory.'/'.$file.EXT))
|
if (file_exists($path = $directory.'/'.$file.EXT)) return require $path;
|
||||||
{
|
|
||||||
return require $path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue