From 8bc128fdaafec01daefe907c74e5e26a10dac49a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 10 Apr 2012 22:36:20 -0500 Subject: [PATCH] cleaning up code. --- laravel/asset.php | 2 +- laravel/autoloader.php | 46 ++++++++++++++++-------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/laravel/asset.php b/laravel/asset.php index 8b6f9308..6bc36478 100644 --- a/laravel/asset.php +++ b/laravel/asset.php @@ -1,4 +1,4 @@ - $directory) - { - if (starts_with($class, $prefix)) - { - return static::load_namespaced($class, $prefix, $directory); - } - } - // If all else fails we will just iterator through the mapped // PSR-0 directories looking for the class. This is the last // resort and slowest loading option for the class. @@ -176,6 +165,20 @@ public static function directories($directory) static::$directories = array_unique(array_merge(static::$directories, $directories)); } + /** + * Map namespaces to directories. + * + * @param array $mappings + * @param string $append + * @return void + */ + public static function namespaces($mappings, $append = '\\') + { + $mappings = static::format_mappings($mappings, $append); + + static::$namespaces = array_merge($mappings, static::$namespaces); + } + /** * Register underscored "namespaces" to directory mappings. * @@ -184,22 +187,7 @@ public static function directories($directory) */ public static function underscored($mappings) { - $mappings = static::format_mappings($mappings, '_'); - - static::$underscored = array_merge($mappings, static::$underscored); - } - - /** - * Map namespaces to directories. - * - * @param array $mappings - * @return void - */ - public static function namespaces($mappings) - { - $mappings = static::format_mappings($mappings, '\\'); - - static::$namespaces = array_merge($mappings, static::$namespaces); + static::namespaces($mappings, '_'); } /**