1 | <?php |
||
9 | class Psr4Autoloader |
||
10 | { |
||
11 | /** |
||
12 | * An associative array where the key is a namespace prefix and the value |
||
13 | * is an array of base directories for classes in that namespace. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $prefixes = []; |
||
18 | |||
19 | /** |
||
20 | * Register loader with SPL autoloader stack. |
||
21 | * |
||
22 | * @return void |
||
23 | */ |
||
24 | public function register() |
||
28 | |||
29 | /** |
||
30 | * Adds a base directory for a namespace prefix. |
||
31 | * |
||
32 | * @param string $prefix The namespace prefix. |
||
33 | * @param string $baseDir A base directory for class files in the |
||
34 | * namespace. |
||
35 | * @param bool $prepend If true, prepend the base directory to the stack |
||
36 | * instead of appending it; this causes it to be searched first rather |
||
37 | * than last. |
||
38 | * @return void |
||
39 | */ |
||
40 | public function addNamespace($prefix, $baseDir, $prepend = false) |
||
60 | |||
61 | /** |
||
62 | * Loads the class file for a given class name. |
||
63 | * |
||
64 | * @param string $class The fully-qualified class name. |
||
65 | * @return mixed The mapped file name on success, or boolean false on |
||
66 | * failure. |
||
67 | */ |
||
68 | public function loadClass($class) |
||
96 | |||
97 | /** |
||
98 | * Load the mapped file for a namespace prefix and relative class. |
||
99 | * |
||
100 | * @param string $prefix The namespace prefix. |
||
101 | * @param string $relativeClass The relative class name. |
||
102 | * @return mixed Boolean false if no mapped file can be loaded, or the |
||
103 | * name of the mapped file that was loaded. |
||
104 | */ |
||
105 | protected function loadMappedFile($prefix, $relativeClass) |
||
131 | |||
132 | /** |
||
133 | * If a file exists, require it from the file system. |
||
134 | * |
||
135 | * @param string $file The file to require. |
||
136 | * @return bool True if the file exists, false if not. |
||
137 | */ |
||
138 | protected function requireFile($file) |
||
148 | } |
||
149 |