@@ -298,11 +298,11 @@ |
||
298 | 298 | $sMethod = $this->xTarget->getMethodName(); |
299 | 299 | // The hooks defined at method level are merged with those defined at class level. |
300 | 300 | $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []); |
301 | - foreach($aMethods as $xKey => $xValue) |
|
301 | + foreach ($aMethods as $xKey => $xValue) |
|
302 | 302 | { |
303 | 303 | $sHookName = $xValue; |
304 | 304 | $aHookArgs = []; |
305 | - if(is_string($xKey)) |
|
305 | + if (is_string($xKey)) |
|
306 | 306 | { |
307 | 307 | $sHookName = $xKey; |
308 | 308 | $aHookArgs = is_array($xValue) ? $xValue : [$xValue]; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // The methods of the CallableClass class must not be exported |
112 | 112 | $xCallableClass = new ReflectionClass(CallableClass::class); |
113 | - foreach($xCallableClass->getMethods(ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
113 | + foreach ($xCallableClass->getMethods(ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
114 | 114 | { |
115 | 115 | $this->aProtectedMethods[] = $xMethod->getName(); |
116 | 116 | } |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function makeClassOptions(string $sClassName, array $aClassOptions, array $aDirectoryOptions): array |
183 | 183 | { |
184 | - foreach($this->aDefaultClassOptions as $sOption => $xValue) |
|
184 | + foreach ($this->aDefaultClassOptions as $sOption => $xValue) |
|
185 | 185 | { |
186 | - if(!isset($aClassOptions[$sOption])) |
|
186 | + if (!isset($aClassOptions[$sOption])) |
|
187 | 187 | { |
188 | 188 | $aClassOptions[$sOption] = $xValue; |
189 | 189 | } |
190 | 190 | } |
191 | - $aClassOptions['excluded'] = (bool)($aClassOptions['excluded'] ?? false); // Convert to bool. |
|
192 | - if(is_string($aClassOptions['protected'])) |
|
191 | + $aClassOptions['excluded'] = (bool) ($aClassOptions['excluded'] ?? false); // Convert to bool. |
|
192 | + if (is_string($aClassOptions['protected'])) |
|
193 | 193 | { |
194 | 194 | $aClassOptions['protected'] = [$aClassOptions['protected']]; // Convert to array. |
195 | 195 | } |
@@ -200,25 +200,25 @@ discard block |
||
200 | 200 | $aDirectoryOptions['classes']['*'] ?? [], // Options for all classes |
201 | 201 | $aDirectoryOptions['classes'][$sClassName] ?? [], // Options for this specific class |
202 | 202 | ]; |
203 | - foreach($aOptionGroups as $aOptionGroup) |
|
203 | + foreach ($aOptionGroups as $aOptionGroup) |
|
204 | 204 | { |
205 | - if(isset($aOptionGroup['separator'])) |
|
205 | + if (isset($aOptionGroup['separator'])) |
|
206 | 206 | { |
207 | - $aClassOptions['separator'] = (string)$aOptionGroup['separator']; |
|
207 | + $aClassOptions['separator'] = (string) $aOptionGroup['separator']; |
|
208 | 208 | } |
209 | - if(isset($aOptionGroup['excluded'])) |
|
209 | + if (isset($aOptionGroup['excluded'])) |
|
210 | 210 | { |
211 | - $aClassOptions['excluded'] = (bool)$aOptionGroup['excluded']; |
|
211 | + $aClassOptions['excluded'] = (bool) $aOptionGroup['excluded']; |
|
212 | 212 | } |
213 | - if(isset($aOptionGroup['protected'])) |
|
213 | + if (isset($aOptionGroup['protected'])) |
|
214 | 214 | { |
215 | - if(is_string($aOptionGroup['protected'])) |
|
215 | + if (is_string($aOptionGroup['protected'])) |
|
216 | 216 | { |
217 | 217 | $aOptionGroup['protected'] = [$aOptionGroup['protected']]; // Convert to array. |
218 | 218 | } |
219 | 219 | $aClassOptions['protected'] = array_merge($aClassOptions['protected'], $aOptionGroup['protected']); |
220 | 220 | } |
221 | - if(isset($aOptionGroup['functions'])) |
|
221 | + if (isset($aOptionGroup['functions'])) |
|
222 | 222 | { |
223 | 223 | $aClassOptions['functions'] = array_merge($aClassOptions['functions'], $aOptionGroup['functions']); |
224 | 224 | } |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | private function getNamespaceClassOptions(string $sClassName) |
265 | 265 | { |
266 | 266 | // Find the corresponding namespace |
267 | - foreach($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
267 | + foreach ($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
268 | 268 | { |
269 | 269 | // Check if the namespace matches the class. |
270 | - if(strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0) |
|
270 | + if (strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0) |
|
271 | 271 | { |
272 | 272 | // Save the class options |
273 | 273 | $this->aClasses[$sClassName] = $this->makeClassOptions($sClassName, |
@@ -288,17 +288,17 @@ discard block |
||
288 | 288 | public function getClassOptions(string $sClassName): array |
289 | 289 | { |
290 | 290 | // Find options for a class registered with namespace. |
291 | - if(!isset($this->aClasses[$sClassName])) |
|
291 | + if (!isset($this->aClasses[$sClassName])) |
|
292 | 292 | { |
293 | 293 | $this->getNamespaceClassOptions($sClassName); |
294 | - if(!isset($this->aClasses[$sClassName])) |
|
294 | + if (!isset($this->aClasses[$sClassName])) |
|
295 | 295 | { |
296 | 296 | // Find options for a class registered without namespace. |
297 | 297 | // We then need to parse all classes to be able to find one. |
298 | 298 | $this->di->getCallableRegistry()->parseDirectories(); |
299 | 299 | } |
300 | 300 | } |
301 | - if(isset($this->aClasses[$sClassName])) |
|
301 | + if (isset($this->aClasses[$sClassName])) |
|
302 | 302 | { |
303 | 303 | return $this->aClasses[$sClassName]; |
304 | 304 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | public function getCallableObjects(): array |
328 | 328 | { |
329 | 329 | $aCallableObjects = []; |
330 | - foreach($this->aClasses as $sClassName => $aOptions) |
|
330 | + foreach ($this->aClasses as $sClassName => $aOptions) |
|
331 | 331 | { |
332 | 332 | $this->di->registerCallableClass($sClassName, $aOptions); |
333 | 333 | $aCallableObjects[$sClassName] = $this->di->getCallableObject($sClassName); |