|
@@ -1,4 +1,4 @@
|
|
-<?php namespace Laravel; defined('DS') or die('No direct script access.');
|
|
|
|
|
|
+<?php namespace Laravel;
|
|
|
|
|
|
class Autoloader {
|
|
class Autoloader {
|
|
|
|
|
|
@@ -52,7 +52,7 @@ class Autoloader {
|
|
// called again for the "real" class name to load its file.
|
|
// called again for the "real" class name to load its file.
|
|
if (isset(static::$aliases[$class]))
|
|
if (isset(static::$aliases[$class]))
|
|
{
|
|
{
|
|
- class_alias(static::$aliases[$class], $class);
|
|
|
|
|
|
+ return class_alias(static::$aliases[$class], $class);
|
|
}
|
|
}
|
|
|
|
|
|
// All classes in Laravel are staticly mapped. There is no crazy search
|
|
// All classes in Laravel are staticly mapped. There is no crazy search
|
|
@@ -76,17 +76,6 @@ class Autoloader {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // If the class uses PEAR-ish style underscores for indicating its
|
|
|
|
- // directory structure we'll load the class using PSR-0 standards
|
|
|
|
- // standards from that directory, trimming the root.
|
|
|
|
- foreach (static::$underscored as $prefix => $directory)
|
|
|
|
- {
|
|
|
|
- if (starts_with($class, $prefix))
|
|
|
|
- {
|
|
|
|
- return static::load_namespaced($class, $prefix, $directory);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// If all else fails we will just iterator through the mapped
|
|
// If all else fails we will just iterator through the mapped
|
|
// PSR-0 directories looking for the class. This is the last
|
|
// PSR-0 directories looking for the class. This is the last
|
|
// resort and slowest loading option for the class.
|
|
// resort and slowest loading option for the class.
|
|
@@ -177,29 +166,28 @@ class Autoloader {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Register underscored "namespaces" to directory mappings.
|
|
|
|
|
|
+ * Map namespaces to directories.
|
|
*
|
|
*
|
|
- * @param array $mappings
|
|
|
|
|
|
+ * @param array $mappings
|
|
|
|
+ * @param string $append
|
|
* @return void
|
|
* @return void
|
|
*/
|
|
*/
|
|
- public static function underscored($mappings)
|
|
|
|
|
|
+ public static function namespaces($mappings, $append = '\\')
|
|
{
|
|
{
|
|
- $mappings = static::format_mappings($mappings, '_');
|
|
|
|
|
|
+ $mappings = static::format_mappings($mappings, $append);
|
|
|
|
|
|
- static::$underscored = array_merge($mappings, static::$underscored);
|
|
|
|
|
|
+ static::$namespaces = array_merge($mappings, static::$namespaces);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Map namespaces to directories.
|
|
|
|
|
|
+ * Register underscored "namespaces" to directory mappings.
|
|
*
|
|
*
|
|
* @param array $mappings
|
|
* @param array $mappings
|
|
* @return void
|
|
* @return void
|
|
*/
|
|
*/
|
|
- public static function namespaces($mappings)
|
|
|
|
|
|
+ public static function underscored($mappings)
|
|
{
|
|
{
|
|
- $mappings = static::format_mappings($mappings, '\\');
|
|
|
|
-
|
|
|
|
- static::$namespaces = array_merge($mappings, static::$namespaces);
|
|
|
|
|
|
+ static::namespaces($mappings, '_');
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|