1 | <?php namespace BuildR\ClassLoader; |
||
17 | class ClassLoaderInitializer { |
||
18 | |||
19 | /** |
||
20 | * @type bool |
||
21 | */ |
||
22 | protected $isLoaded = FALSE; |
||
23 | |||
24 | /** |
||
25 | * The files that loaded during the initialization phase |
||
26 | * |
||
27 | * @type array |
||
28 | */ |
||
29 | protected static $files = [ |
||
30 | 'Modules' . DIRECTORY_SEPARATOR . 'ClassLoaderModuleInterface.php', |
||
31 | 'Modules' . DIRECTORY_SEPARATOR . 'AbstractClassLoaderModule.php', |
||
32 | 'Exception' . DIRECTORY_SEPARATOR . 'ModuleException.php', |
||
33 | 'Exception' . DIRECTORY_SEPARATOR . 'ClassLoaderException.php', |
||
34 | 'ModuleLoader.php', |
||
35 | 'ClassLoader.php', |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * Extends the initializer internal file registry before initialize |
||
40 | * |
||
41 | * @param $additionalFile |
||
42 | */ |
||
43 | 2 | public function extend($additionalFile) { |
|
44 | 2 | if($this->isLoaded === TRUE) { |
|
45 | 1 | trigger_error('The initializer is loaded, so you cannot extend a loaded initializer!', E_USER_NOTICE); |
|
46 | 1 | } |
|
47 | |||
48 | 2 | self::$files = array_merge(self::$files, (array) $additionalFile); |
|
49 | 2 | } |
|
50 | |||
51 | /** |
||
52 | * Determines that the current instance of the initializer is loaded or not |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | 1 | public function isLoaded() { |
|
59 | |||
60 | /** |
||
61 | * Returns all files loaded by the initializer |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | 2 | public static function getLoadedFiles() { |
|
68 | |||
69 | /** |
||
70 | * Load all files that needs to use the class loader |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | 4 | public function load() { |
|
90 | |||
91 | } |
||
92 |