adjusted autoloader priority for best performance.

This commit is contained in:
Taylor Otwell 2011-11-09 22:58:07 -06:00
parent 3854165595
commit d55a5e722b
1 changed files with 14 additions and 14 deletions

View File

@ -69,20 +69,6 @@ protected static function find($class)
return LIBRARY_PATH.str_replace('_', '/', $file).EXT;
}
// Since not all controllers will be resolved by the controller resolver,
// we will do a quick check in the controller directory for the class.
// For instance, since base controllers would not be resolved by the
// controller class, we will need to resolve them here.
if (strpos($class, '_Controller') !== false)
{
$controller = str_replace(array('_Controller', '_'), array('', '/'), $class);
if (file_exists($path = strtolower(CONTROLLER_PATH.$controller.EXT)))
{
return $path;
}
}
// Next we will search through the common Laravel paths for the class file.
// The Laravel framework path, along with the libraries and models paths
// will be searched according to the Laravel class naming standard.
@ -105,6 +91,20 @@ protected static function find($class)
return $path;
}
// Since not all controllers will be resolved by the controller resolver,
// we will do a quick check in the controller directory for the class.
// For instance, since base controllers would not be resolved by the
// controller class, we will need to resolve them here.
if (strpos($class, '_Controller') !== false)
{
$controller = str_replace(array('_Controller', '_'), array('', '/'), $class);
if (file_exists($path = strtolower(CONTROLLER_PATH.$controller.EXT)))
{
return $path;
}
}
}
}