1 | <?php |
||
22 | class CallableRepository |
||
23 | { |
||
24 | /** |
||
25 | * The classes |
||
26 | * |
||
27 | * These are all the registered classes. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $aClasses = []; |
||
32 | |||
33 | /** |
||
34 | * The namespaces |
||
35 | * |
||
36 | * These are all the namespaces found in registered directories. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $aNamespaces = []; |
||
41 | |||
42 | /** |
||
43 | * The created callable objects. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $aCallableObjects = []; |
||
48 | |||
49 | /** |
||
50 | * The options to be applied to callable objects. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $aCallableOptions = []; |
||
55 | |||
56 | /** |
||
57 | * Get a given class options from specified directory options |
||
58 | * |
||
59 | * @param string $sClassName The class name |
||
60 | * @param array $aClassOptions The default class options |
||
61 | * @param array $aDirectoryOptions The directory options |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | public function makeClassOptions($sClassName, array $aClassOptions, array $aDirectoryOptions) |
||
87 | |||
88 | /** |
||
89 | * |
||
90 | * @param string $sClassName The class name |
||
91 | * @param array $aClassOptions The default class options |
||
92 | * @param array $aDirectoryOptions The directory options |
||
93 | * |
||
94 | * @return void |
||
95 | */ |
||
96 | public function addClass($sClassName, array $aClassOptions, array $aDirectoryOptions = []) |
||
100 | |||
101 | /** |
||
102 | * |
||
103 | * @param string $sNamespace The namespace |
||
104 | * @param array|string $aOptions The associated options |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | public function addNamespace($sNamespace, $aOptions) |
||
112 | |||
113 | /** |
||
114 | * Find the options associated with a registered class name |
||
115 | * |
||
116 | * @param string $sClassName The class name |
||
117 | * |
||
118 | * @return array|null |
||
119 | */ |
||
120 | public function getClassOptions($sClassName) |
||
129 | |||
130 | /** |
||
131 | * Find a callable object by class name |
||
132 | * |
||
133 | * @param string $sClassName The class name of the callable object |
||
134 | * @param array $aOptions The callable object options |
||
135 | * |
||
136 | * @return CallableObject|null |
||
137 | */ |
||
138 | public function createCallableObject($sClassName, array $aOptions) |
||
172 | |||
173 | /** |
||
174 | * Get all registered classes |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | public function getClasses() |
||
182 | |||
183 | /** |
||
184 | * Get all registered namespaces |
||
185 | * |
||
186 | * @return array |
||
187 | */ |
||
188 | public function getNamespaces() |
||
192 | |||
193 | /** |
||
194 | * Get all registered callable objects |
||
195 | * |
||
196 | * @return array |
||
197 | */ |
||
198 | public function getCallableObjects() |
||
202 | |||
203 | /** |
||
204 | * Get all registered callable objects options |
||
205 | * |
||
206 | * @return array |
||
207 | */ |
||
208 | public function getCallableOptions() |
||
212 | } |
||
213 |