|
22 | 22 | * An autoloader that uses both PSR4 autoloading, and traditional classmaps. |
23 | 23 | * |
24 | 24 | * Given a foo-bar package of classes in the file system at the following paths: |
25 | | - *``` |
| 25 | + * ``` |
26 | 26 | * /path/to/packages/foo-bar/ |
27 | 27 | * /src |
28 | 28 | * Baz.php # Foo\Bar\Baz |
29 | 29 | * Qux/ |
30 | 30 | * Quux.php # Foo\Bar\Qux\Quux |
31 | | - *``` |
| 31 | + * ``` |
32 | 32 | * you can add the path to the configuration array that is passed in the constructor. |
33 | 33 | * The Config array consists of 2 primary keys, both of which are associative arrays: |
34 | 34 | * 'psr4', and 'classmap'. |
35 | | - *``` |
| 35 | + * ``` |
36 | 36 | * $Config = [ |
37 | 37 | * 'psr4' => [ |
38 | 38 | * 'Foo\Bar' => '/path/to/packages/foo-bar' |
|
41 | 41 | * 'MyClass' => '/path/to/class/file.php' |
42 | 42 | * ] |
43 | 43 | * ]; |
44 | | - *``` |
| 44 | + * ``` |
45 | 45 | * Example: |
46 | | - *``` |
| 46 | + * ``` |
47 | 47 | * <?php |
48 | 48 | * // our configuration array |
49 | 49 | * $Config = [ ... ]; |
50 | 50 | * $loader = new \CodeIgniter\Autoloader\Autoloader($Config); |
51 | 51 | * |
52 | 52 | * // register the autoloader |
53 | 53 | * $loader->register(); |
54 | | - *``` |
| 54 | + * ``` |
55 | 55 | */ |
56 | 56 | class Autoloader |
57 | 57 | { |
@@ -258,15 +258,6 @@ protected function loadInNamespace(string $class) |
258 | 258 | { |
259 | 259 | if (strpos($class, '\\') === false) |
260 | 260 | { |
261 | | - $class = 'Config\\' . $class; |
262 | | - $filePath = APPPATH . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; |
263 | | - $filename = $this->includeFile($filePath); |
264 | | - |
265 | | - if ($filename) |
266 | | - { |
267 | | - return $filename; |
268 | | - } |
269 | | - |
270 | 261 | return false; |
271 | 262 | } |
272 | 263 |
|
@@ -353,7 +344,9 @@ protected function discoverComposerNamespaces() |
353 | 344 | return; |
354 | 345 | } |
355 | 346 |
|
356 | | - /** @var ClassLoader $composer */ |
| 347 | + /** |
| 348 | + * @var ClassLoader $composer |
| 349 | + */ |
357 | 350 | $composer = include COMPOSER_PATH; |
358 | 351 | $paths = $composer->getPrefixesPsr4(); |
359 | 352 | $classes = $composer->getClassMap(); |
|
0 commit comments