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