| @@ -14,15 +14,8 @@ | ||
| 14 | 14 | */ |
| 15 | 15 | class CJT_Framework_Autoload_Loader { |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * | |
| 19 | - * | |
| 20 | - * @var mixed | |
| 21 | - */ | |
| 22 | - protected static $instances = array(); | |
| 23 | - | |
| 24 | - /** | |
| 25 | 18 | * put your comment there... |
| 26 | 19 | * |
| 27 | 20 | * @var mixed |
| 28 | 21 | */ |
| @@ -65,32 +58,18 @@ | ||
| 65 | 58 | * @param mixed $prefix |
| 66 | 59 | * @param mixed $path |
| 67 | 60 | */ |
| 68 | 61 | public static function autoLoad($prefix = null, $path = null) { |
| 62 | + // Hold all auto load instances. | |
| 63 | + static $instances = array(); | |
| 69 | 64 | // Identify instances by prefixes! |
| 70 | - if (!isset(self::$instances[$prefix])) { | |
| 71 | - self::$instances[$prefix] = new CJT_Framework_Autoload_Loader($prefix, $path); | |
| 65 | + if (!isset($instances[$prefix])) { | |
| 66 | + $instances[$prefix] = new CJT_Framework_Autoload_Loader($prefix, $path); | |
| 72 | 67 | } |
| 73 | - return isset(self::$instances[$prefix]) ? self::$instances[$prefix] : null; | |
| 68 | + return $instances[$prefix]; | |
| 74 | 69 | } |
| 75 | 70 | |
| 76 | 71 | /** |
| 77 | - * Find ClassAutoloader instance used for loading specific class. | |
| 78 | - * | |
| 79 | - * The method is using Prefix algorithm for finding class autoloader | |
| 80 | - * | |
| 81 | - * @param mixed $className | |
| 82 | - */ | |
| 83 | - public static function & findClassLoader($className) { | |
| 84 | - # Getting class prefix | |
| 85 | - $classComponents = explode('_', $className); | |
| 86 | - $prefix = $classComponents[0]; | |
| 87 | - # Find autoloader | |
| 88 | - $instance = isset(self::$instances[$prefix]) ? self::$instances[$prefix] : null; | |
| 89 | - return $instance; | |
| 90 | - } | |
| 91 | - | |
| 92 | - /** | |
| 93 | 72 | * put your comment there... |
| 94 | 73 | * |
| 95 | 74 | * @param mixed $clsName |
| 96 | 75 | */ |
| @@ -138,24 +117,8 @@ | ||
| 138 | 117 | $component = $this->getClassComponent($name); |
| 139 | 118 | // Get class absolute path. |
| 140 | 119 | $path = $this->path . DIRECTORY_SEPARATOR . $component->path; |
| 141 | 120 | return $path . DIRECTORY_SEPARATOR . $file; |
| 142 | - } | |
| 143 | - | |
| 144 | - /** | |
| 145 | - * put your comment there... | |
| 146 | - * | |
| 147 | - */ | |
| 148 | - public function getPath() { | |
| 149 | - return $this->path; | |
| 150 | - } | |
| 151 | - | |
| 152 | - /** | |
| 153 | - * put your comment there... | |
| 154 | - * | |
| 155 | - */ | |
| 156 | - public function getPrefix() { | |
| 157 | - return $this->prefix; | |
| 158 | 121 | } |
| 159 | 122 | |
| 160 | 123 | /** |
| 161 | 124 | * put your comment there... |