1 | <?php |
||
22 | class ComponentManager implements ComponentManagerInterface |
||
23 | { |
||
24 | protected static $componentClassName = 'FuelComponent'; |
||
25 | |||
26 | /** |
||
27 | * @var ComponentInterface[] |
||
28 | */ |
||
29 | protected $loadedComponents = []; |
||
30 | |||
31 | /** |
||
32 | * Contains a list of component paths for components that have already been requested, indexed by component name. |
||
33 | * |
||
34 | * @var string[] |
||
35 | */ |
||
36 | protected $availableComponents = []; |
||
37 | |||
38 | /** |
||
39 | * Gets a component, loading it if needed. |
||
40 | * |
||
41 | * @param string $name |
||
42 | * |
||
43 | * @return ComponentInterface |
||
44 | */ |
||
45 | 1 | public function get(string $name) : ComponentInterface |
|
54 | |||
55 | /** |
||
56 | * Loads the given component. |
||
57 | * |
||
58 | * TODO: Also load dependant components |
||
59 | * |
||
60 | * @param string $name |
||
61 | * |
||
62 | * @return ComponentInterface |
||
63 | */ |
||
64 | 4 | public function load(string $name) : ComponentInterface |
|
87 | |||
88 | /** |
||
89 | * Loads a component by name. |
||
90 | * |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | 2 | public function loaded(string $name) : bool |
|
99 | |||
100 | /** |
||
101 | * Unloads a component. |
||
102 | * |
||
103 | * @param string $name |
||
104 | * |
||
105 | * @return ComponentManagerInterface |
||
106 | */ |
||
107 | 1 | public function unload(string $name) : ComponentManagerInterface |
|
116 | |||
117 | } |
||
118 |