1 | <?php |
||
10 | class ModuleList |
||
11 | { |
||
12 | /** |
||
13 | * @const ERR_NOT_FOUND Exception code if a module is not found |
||
14 | */ |
||
15 | const ERR_NOT_FOUND = 1311001; |
||
16 | |||
17 | /** |
||
18 | * @const ERR_NEEDED_NOT_FOUND Exception code if a needed dependency is |
||
19 | * not found. |
||
20 | */ |
||
21 | const ERR_NEEDED_NOT_FOUND = 1311002; |
||
22 | |||
23 | /** |
||
24 | * @var \BFW\Module[] All module instance |
||
25 | */ |
||
26 | protected $modules = []; |
||
27 | |||
28 | /** |
||
29 | * @var array $loadTree The dependency tree for all modules |
||
30 | */ |
||
31 | protected $loadTree = []; |
||
32 | |||
33 | /** |
||
34 | * Get the module's list |
||
35 | * |
||
36 | * @return \BFW\Module[] |
||
37 | */ |
||
38 | public function getModules() |
||
42 | |||
43 | /** |
||
44 | * Get the dependency tree |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getLoadTree() |
||
52 | |||
53 | /** |
||
54 | * Add a module to the modules's list |
||
55 | * And instantiate \BFW\Module for this module |
||
56 | * |
||
57 | * @param string $moduleName The module's name |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | public function addModule($moduleName) |
||
66 | |||
67 | /** |
||
68 | * Get the \BFW\Module instance for a module |
||
69 | * |
||
70 | * @param string $moduleName The module's name |
||
71 | * |
||
72 | * @return \BFW\Module |
||
73 | * |
||
74 | * @throws Exception If the module is not found |
||
75 | */ |
||
76 | public function getModuleForName($moduleName) |
||
87 | |||
88 | /** |
||
89 | * Read the "needMe" property for each module and add the dependency |
||
90 | * |
||
91 | * @throws \Exception If the dependency is not found |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | public function readNeedMeDependencies() |
||
121 | |||
122 | /** |
||
123 | * Generate the dependency tree for all declared module |
||
124 | * |
||
125 | * @return void |
||
126 | */ |
||
127 | public function generateTree() |
||
148 | } |
||
149 |