@@ -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,14 +181,14 @@ 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 | - if(is_string($aClassOptions['protected'])) |
|
191 | + if (is_string($aClassOptions['protected'])) |
|
192 | 192 | { |
193 | 193 | $aClassOptions['protected'] = [$aClassOptions['protected']]; // Convert to array. |
194 | 194 | } |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | $aDirectoryOptions['classes']['*'] ?? [], // Options for all classes |
200 | 200 | $aDirectoryOptions['classes'][$sClassName] ?? [], // Options for this specific class |
201 | 201 | ]; |
202 | - foreach($aOptionGroups as $aOptionGroup) |
|
202 | + foreach ($aOptionGroups as $aOptionGroup) |
|
203 | 203 | { |
204 | - if(isset($aOptionGroup['separator'])) |
|
204 | + if (isset($aOptionGroup['separator'])) |
|
205 | 205 | { |
206 | 206 | $aClassOptions['separator'] = $aOptionGroup['separator']; |
207 | 207 | } |
208 | - if(isset($aOptionGroup['protected'])) |
|
208 | + if (isset($aOptionGroup['protected'])) |
|
209 | 209 | { |
210 | - if(is_string($aOptionGroup['protected'])) |
|
210 | + if (is_string($aOptionGroup['protected'])) |
|
211 | 211 | { |
212 | 212 | $aOptionGroup['protected'] = [$aOptionGroup['protected']]; // Convert to array. |
213 | 213 | } |
214 | 214 | $aClassOptions['protected'] = array_merge($aClassOptions['protected'], $aOptionGroup['protected']); |
215 | 215 | } |
216 | - if(isset($aOptionGroup['functions'])) |
|
216 | + if (isset($aOptionGroup['functions'])) |
|
217 | 217 | { |
218 | 218 | $aClassOptions['functions'] = array_merge($aClassOptions['functions'], $aOptionGroup['functions']); |
219 | 219 | } |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | private function getNamespaceClassOptions(string $sClassName) |
260 | 260 | { |
261 | 261 | // Find the corresponding namespace |
262 | - foreach($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
262 | + foreach ($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
263 | 263 | { |
264 | 264 | // Check if the namespace matches the class. |
265 | - if(strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0) |
|
265 | + if (strncmp($sClassName, $sNamespace . '\\', strlen($sNamespace) + 1) === 0) |
|
266 | 266 | { |
267 | 267 | // Save the class options |
268 | 268 | $this->aClasses[$sClassName] = $this->makeClassOptions($sClassName, |
@@ -283,17 +283,17 @@ discard block |
||
283 | 283 | public function getClassOptions(string $sClassName): array |
284 | 284 | { |
285 | 285 | // Find options for a class registered with namespace. |
286 | - if(!isset($this->aClasses[$sClassName])) |
|
286 | + if (!isset($this->aClasses[$sClassName])) |
|
287 | 287 | { |
288 | 288 | $this->getNamespaceClassOptions($sClassName); |
289 | - if(!isset($this->aClasses[$sClassName])) |
|
289 | + if (!isset($this->aClasses[$sClassName])) |
|
290 | 290 | { |
291 | 291 | // Find options for a class registered without namespace. |
292 | 292 | // We then need to parse all classes to be able to find one. |
293 | 293 | $this->di->getCallableRegistry()->parseDirectories(); |
294 | 294 | } |
295 | 295 | } |
296 | - if(isset($this->aClasses[$sClassName])) |
|
296 | + if (isset($this->aClasses[$sClassName])) |
|
297 | 297 | { |
298 | 298 | return $this->aClasses[$sClassName]; |
299 | 299 | } |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | public function getCallableObjects(): array |
323 | 323 | { |
324 | 324 | $aCallableObjects = []; |
325 | - foreach($this->aClasses as $sClassName => $aOptions) |
|
325 | + foreach ($this->aClasses as $sClassName => $aOptions) |
|
326 | 326 | { |
327 | - if(!$this->di->h($sClassName)) |
|
327 | + if (!$this->di->h($sClassName)) |
|
328 | 328 | { |
329 | 329 | $this->di->registerCallableClass($sClassName, $aOptions); |
330 | 330 | } |
@@ -207,36 +207,36 @@ |
||
207 | 207 | switch($sName) |
208 | 208 | { |
209 | 209 | // Set the separator |
210 | - case 'separator': |
|
211 | - if($xValue === '_' || $xValue === '.') |
|
212 | - { |
|
213 | - $this->sSeparator = $xValue; |
|
214 | - } |
|
215 | - break; |
|
216 | - // Set the protected methods |
|
217 | - case 'protected': |
|
218 | - if(is_array($xValue)) |
|
219 | - { |
|
220 | - $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
|
221 | - } |
|
222 | - break; |
|
223 | - // Set the methods to call before processing the request |
|
224 | - case '__before': |
|
225 | - $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
226 | - break; |
|
227 | - // Set the methods to call after processing the request |
|
228 | - case '__after': |
|
229 | - $this->setHookMethods($this->aAfterMethods, $xValue); |
|
230 | - break; |
|
231 | - // Set the attributes to inject in the callable object |
|
232 | - case '__di': |
|
233 | - $this->aAttributes = array_merge($this->aAttributes, $xValue); |
|
234 | - break; |
|
235 | - case 'excluded': |
|
236 | - $this->bExcluded = (bool)$xValue; |
|
237 | - break; |
|
238 | - default: |
|
239 | - break; |
|
210 | + case 'separator': |
|
211 | + if($xValue === '_' || $xValue === '.') |
|
212 | + { |
|
213 | + $this->sSeparator = $xValue; |
|
214 | + } |
|
215 | + break; |
|
216 | + // Set the protected methods |
|
217 | + case 'protected': |
|
218 | + if(is_array($xValue)) |
|
219 | + { |
|
220 | + $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
|
221 | + } |
|
222 | + break; |
|
223 | + // Set the methods to call before processing the request |
|
224 | + case '__before': |
|
225 | + $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
226 | + break; |
|
227 | + // Set the methods to call after processing the request |
|
228 | + case '__after': |
|
229 | + $this->setHookMethods($this->aAfterMethods, $xValue); |
|
230 | + break; |
|
231 | + // Set the attributes to inject in the callable object |
|
232 | + case '__di': |
|
233 | + $this->aAttributes = array_merge($this->aAttributes, $xValue); |
|
234 | + break; |
|
235 | + case 'excluded': |
|
236 | + $this->bExcluded = (bool)$xValue; |
|
237 | + break; |
|
238 | + default: |
|
239 | + break; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 |
@@ -186,8 +186,7 @@ |
||
186 | 186 | if(is_array($xMethodToCall)) |
187 | 187 | { |
188 | 188 | $aHookMethods[$sCalledMethod] = $xMethodToCall; |
189 | - } |
|
190 | - elseif(is_string($xMethodToCall)) |
|
189 | + } elseif(is_string($xMethodToCall)) |
|
191 | 190 | { |
192 | 191 | $aHookMethods[$sCalledMethod] = [$xMethodToCall]; |
193 | 192 | } |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | */ |
194 | 194 | private function setHookMethods(array &$aHookMethods, $xValue) |
195 | 195 | { |
196 | - foreach($xValue as $sCalledMethod => $xMethodToCall) |
|
196 | + foreach ($xValue as $sCalledMethod => $xMethodToCall) |
|
197 | 197 | { |
198 | - if(is_array($xMethodToCall)) |
|
198 | + if (is_array($xMethodToCall)) |
|
199 | 199 | { |
200 | 200 | $aHookMethods[$sCalledMethod] = $xMethodToCall; |
201 | 201 | } |
202 | - elseif(is_string($xMethodToCall)) |
|
202 | + elseif (is_string($xMethodToCall)) |
|
203 | 203 | { |
204 | 204 | $aHookMethods[$sCalledMethod] = [$xMethodToCall]; |
205 | 205 | } |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function configure(string $sName, $xValue) |
218 | 218 | { |
219 | - switch($sName) |
|
219 | + switch ($sName) |
|
220 | 220 | { |
221 | 221 | // Set the separator |
222 | 222 | case 'separator': |
223 | - if($xValue === '_' || $xValue === '.') |
|
223 | + if ($xValue === '_' || $xValue === '.') |
|
224 | 224 | { |
225 | 225 | $this->sSeparator = $xValue; |
226 | 226 | } |
227 | 227 | break; |
228 | 228 | // Set the protected methods |
229 | 229 | case 'protected': |
230 | - if(is_array($xValue)) |
|
230 | + if (is_array($xValue)) |
|
231 | 231 | { |
232 | 232 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $this->aAttributes = array_merge($this->aAttributes, $xValue); |
246 | 246 | break; |
247 | 247 | case 'excluded': |
248 | - $this->bExcluded = (bool)$xValue; |
|
248 | + $this->bExcluded = (bool) $xValue; |
|
249 | 249 | break; |
250 | 250 | default: |
251 | 251 | break; |
@@ -295,16 +295,16 @@ discard block |
||
295 | 295 | */ |
296 | 296 | private function getOptionValue(array $aCommonOptions, array $aMethodOptions, string $sOptionName) |
297 | 297 | { |
298 | - if(!isset($aCommonOptions[$sOptionName])) |
|
298 | + if (!isset($aCommonOptions[$sOptionName])) |
|
299 | 299 | { |
300 | 300 | return $aMethodOptions[$sOptionName]; |
301 | 301 | } |
302 | - if(!isset($aMethodOptions[$sOptionName])) |
|
302 | + if (!isset($aMethodOptions[$sOptionName])) |
|
303 | 303 | { |
304 | 304 | return $aCommonOptions[$sOptionName]; |
305 | 305 | } |
306 | 306 | // If both are not arrays, return the latest. |
307 | - if(!is_array($aCommonOptions[$sOptionName]) && !is_array($aMethodOptions[$sOptionName])) |
|
307 | + if (!is_array($aCommonOptions[$sOptionName]) && !is_array($aMethodOptions[$sOptionName])) |
|
308 | 308 | { |
309 | 309 | return $aMethodOptions[$sOptionName]; |
310 | 310 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $aMethodOptions = isset($this->aOptions[$sMethodName]) ? $this->aOptions[$sMethodName] : []; |
329 | 329 | $aOptionNames = array_unique(array_merge(array_keys($aCommonOptions), array_keys($aMethodOptions))); |
330 | 330 | $aOptions = []; |
331 | - foreach($aOptionNames as $sOptionName) |
|
331 | + foreach ($aOptionNames as $sOptionName) |
|
332 | 332 | { |
333 | 333 | $aOptions[$sOptionName] = $this->getOptionValue($aCommonOptions, $aMethodOptions, $sOptionName); |
334 | 334 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | // $aMethods = $aHookMethods[$sMethod] ?? $aHookMethods['*'] ?? []; |
413 | 413 | // The hooks defined at method level are merged with those defined at class level. |
414 | 414 | $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []); |
415 | - foreach($aMethods as $xKey => $xValue) |
|
415 | + foreach ($aMethods as $xKey => $xValue) |
|
416 | 416 | { |
417 | 417 | $sHookName = $xValue; |
418 | 418 | $aHookArgs = []; |
419 | - if(is_string($xKey)) |
|
419 | + if (is_string($xKey)) |
|
420 | 420 | { |
421 | 421 | $sHookName = $xKey; |
422 | 422 | $aHookArgs = is_array($xValue) ? $xValue : [$xValue]; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | // $aAttributes = $this->aAttributes[$sMethod] ?? $this->aAttributes['*'] ?? []; |
458 | 458 | // The attributes defined at method level are merged with those defined at class level. |
459 | 459 | $aAttributes = array_merge($this->aAttributes['*'] ?? [], $this->aAttributes[$sMethod] ?? []); |
460 | - foreach($aAttributes as $sName => $sClass) |
|
460 | + foreach ($aAttributes as $sName => $sClass) |
|
461 | 461 | { |
462 | 462 | // Set the protected attributes of the object |
463 | 463 | $cSetter = function($c) use($sName, $sClass) { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | // Set the Jaxon request target in the helper |
472 | - if($this->xRegisteredObject instanceof CallableClass) |
|
472 | + if ($this->xRegisteredObject instanceof CallableClass) |
|
473 | 473 | { |
474 | 474 | // Set the protected attributes of the object |
475 | 475 | $cSetter = function() use($xTarget) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function setDataBag() |
41 | 41 | { |
42 | - if($this->xDataBag !== null) |
|
42 | + if ($this->xDataBag !== null) |
|
43 | 43 | { |
44 | 44 | return; |
45 | 45 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | $aBody = $xRequest->getParsedBody(); |
49 | 49 | $aParams = $xRequest->getQueryParams(); |
50 | 50 | $aData = is_array($aBody) ? |
51 | - $this->readData($aBody['jxnbags'] ?? []) : |
|
52 | - $this->readData($aParams['jxnbags'] ?? []); |
|
51 | + $this->readData($aBody['jxnbags'] ?? []) : $this->readData($aParams['jxnbags'] ?? []); |
|
53 | 52 | $this->xDataBag = new DataBag($aData); |
54 | 53 | } |
55 | 54 | |
@@ -69,7 +68,7 @@ discard block |
||
69 | 68 | private function readData($xData): array |
70 | 69 | { |
71 | 70 | // Todo: clean input data. |
72 | - if(is_string($xData)) |
|
71 | + if (is_string($xData)) |
|
73 | 72 | { |
74 | 73 | return json_decode($xData, true) ?: []; |
75 | 74 | } |
@@ -105,7 +104,7 @@ discard block |
||
105 | 104 | public function writeCommand() |
106 | 105 | { |
107 | 106 | $this->setDataBag(); |
108 | - if($this->xDataBag->touched()) |
|
107 | + if ($this->xDataBag->touched()) |
|
109 | 108 | { |
110 | 109 | $this->addCommand(['cmd' => 'bags.set'], $this->xDataBag->getAll()); |
111 | 110 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | */ |
127 | 127 | private function getLibraries(): array |
128 | 128 | { |
129 | - if($this->aLibraries === null) |
|
129 | + if ($this->aLibraries === null) |
|
130 | 130 | { |
131 | 131 | $this->aLibraries = $this->xLibraryManager->getLibraries(); |
132 | 132 | } |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | private function updateContainer(Config $xConfig) |
86 | 86 | { |
87 | 87 | $aOptions = $xConfig->getOption('container.set', []); |
88 | - foreach($aOptions as $xKey => $xValue) |
|
88 | + foreach ($aOptions as $xKey => $xValue) |
|
89 | 89 | { |
90 | 90 | // The key is the class name. It must be a string. |
91 | - $this->di->set((string)$xKey, $xValue); |
|
91 | + $this->di->set((string) $xKey, $xValue); |
|
92 | 92 | } |
93 | 93 | $aOptions = $xConfig->getOption('container.val', []); |
94 | - foreach($aOptions as $xKey => $xValue) |
|
94 | + foreach ($aOptions as $xKey => $xValue) |
|
95 | 95 | { |
96 | 96 | // The key is the class name. It must be a string. |
97 | - $this->di->val((string)$xKey, $xValue); |
|
97 | + $this->di->val((string) $xKey, $xValue); |
|
98 | 98 | } |
99 | 99 | $aOptions = $xConfig->getOption('container.auto', []); |
100 | - foreach($aOptions as $xValue) |
|
100 | + foreach ($aOptions as $xValue) |
|
101 | 101 | { |
102 | 102 | // The key is the class name. It must be a string. |
103 | - $this->di->auto((string)$xValue); |
|
103 | + $this->di->auto((string) $xValue); |
|
104 | 104 | } |
105 | 105 | $aOptions = $xConfig->getOption('container.alias', []); |
106 | - foreach($aOptions as $xKey => $xValue) |
|
106 | + foreach ($aOptions as $xKey => $xValue) |
|
107 | 107 | { |
108 | 108 | // The key is the class name. It must be a string. |
109 | - $this->di->alias((string)$xKey, (string)$xValue); |
|
109 | + $this->di->alias((string) $xKey, (string) $xValue); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | */ |
122 | 122 | private function registerCallables(array $aOptions, string $sCallableType) |
123 | 123 | { |
124 | - foreach($aOptions as $xKey => $xValue) |
|
124 | + foreach ($aOptions as $xKey => $xValue) |
|
125 | 125 | { |
126 | - if(is_integer($xKey) && is_string($xValue)) |
|
126 | + if (is_integer($xKey) && is_string($xValue)) |
|
127 | 127 | { |
128 | 128 | // Register a function without options |
129 | 129 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
130 | 130 | } |
131 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
131 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
132 | 132 | { |
133 | 133 | // Register a function with options |
134 | 134 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | { |
172 | 172 | // $this->aPackages contains packages config file paths. |
173 | 173 | $aLibOptions = $sClassName::config(); |
174 | - if(is_string($aLibOptions)) |
|
174 | + if (is_string($aLibOptions)) |
|
175 | 175 | { |
176 | 176 | // A string is supposed to be the path to a config file. |
177 | 177 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
178 | 178 | } |
179 | - elseif(!is_array($aLibOptions)) |
|
179 | + elseif (!is_array($aLibOptions)) |
|
180 | 180 | { |
181 | 181 | // Otherwise, anything else than an array is not accepted. |
182 | 182 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function registerPackage(string $sClassName, array $aUserOptions) |
198 | 198 | { |
199 | 199 | $sClassName = trim($sClassName, '\\ '); |
200 | - if(!is_subclass_of($sClassName, Package::class)) |
|
200 | + if (!is_subclass_of($sClassName, Package::class)) |
|
201 | 201 | { |
202 | 202 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
203 | 203 | throw new SetupException($sMessage); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // Register packages |
243 | 243 | $aPackageConfig = $xAppConfig->getOption('packages', []); |
244 | - foreach($aPackageConfig as $sClassName => $aPkgOptions) |
|
244 | + foreach ($aPackageConfig as $sClassName => $aPkgOptions) |
|
245 | 245 | { |
246 | 246 | $this->registerPackage($sClassName, $aPkgOptions); |
247 | 247 | } |
@@ -127,8 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | // Register a function without options |
129 | 129 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
130 | - } |
|
131 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
130 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
132 | 131 | { |
133 | 132 | // Register a function with options |
134 | 133 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -175,8 +174,7 @@ discard block |
||
175 | 174 | { |
176 | 175 | // A string is supposed to be the path to a config file. |
177 | 176 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
178 | - } |
|
179 | - elseif(!is_array($aLibOptions)) |
|
177 | + } elseif(!is_array($aLibOptions)) |
|
180 | 178 | { |
181 | 179 | // Otherwise, anything else than an array is not accepted. |
182 | 180 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -62,12 +62,12 @@ |
||
62 | 62 | public function request(string $sClassName = ''): ?RequestFactory |
63 | 63 | { |
64 | 64 | $sClassName = trim($sClassName); |
65 | - if(!$sClassName) |
|
65 | + if (!$sClassName) |
|
66 | 66 | { |
67 | 67 | // There is a single request factory for all callable functions. |
68 | 68 | return $this->xRequestFactory->noPrefix(false); |
69 | 69 | } |
70 | - if($sClassName === '.') |
|
70 | + if ($sClassName === '.') |
|
71 | 71 | { |
72 | 72 | // The request factory is for a js function, not a Jaxon call. |
73 | 73 | return $this->xRequestFactory->noPrefix(true); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | public function onChange(Config $xConfig, string $sName) |
58 | 58 | { |
59 | - foreach($this->aListeners as $sListener) |
|
59 | + foreach ($this->aListeners as $sListener) |
|
60 | 60 | { |
61 | 61 | $this->di->g($sListener)->onChange($xConfig, $sName); |
62 | 62 | } |
@@ -75,22 +75,22 @@ discard block |
||
75 | 75 | { |
76 | 76 | return $this->xConfigReader->read($sConfigFile); |
77 | 77 | } |
78 | - catch(YamlExtension $e) |
|
78 | + catch (YamlExtension $e) |
|
79 | 79 | { |
80 | 80 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
81 | 81 | throw new SetupException($sMessage); |
82 | 82 | } |
83 | - catch(FileExtension $e) |
|
83 | + catch (FileExtension $e) |
|
84 | 84 | { |
85 | 85 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
86 | 86 | throw new SetupException($sMessage); |
87 | 87 | } |
88 | - catch(FileAccess $e) |
|
88 | + catch (FileAccess $e) |
|
89 | 89 | { |
90 | 90 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
91 | 91 | throw new SetupException($sMessage); |
92 | 92 | } |
93 | - catch(FileContent $e) |
|
93 | + catch (FileContent $e) |
|
94 | 94 | { |
95 | 95 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
96 | 96 | throw new SetupException($sMessage); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // Call the config change listeners. |
116 | 116 | $this->xEventManager->onChange($this->xConfig, ''); |
117 | 117 | } |
118 | - catch(DataDepth $e) |
|
118 | + catch (DataDepth $e) |
|
119 | 119 | { |
120 | 120 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
121 | 121 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | try |
138 | 138 | { |
139 | - if(!$this->xConfig->setOptions($aOptions, $sKeys)) |
|
139 | + if (!$this->xConfig->setOptions($aOptions, $sKeys)) |
|
140 | 140 | { |
141 | 141 | return false; |
142 | 142 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $this->xEventManager->onChange($this->xConfig, ''); |
145 | 145 | return true; |
146 | 146 | } |
147 | - catch(DataDepth $e) |
|
147 | + catch (DataDepth $e) |
|
148 | 148 | { |
149 | 149 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
150 | 150 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | { |
220 | 220 | return new Config($aOptions, $sKeys); |
221 | 221 | } |
222 | - catch(DataDepth $e) |
|
222 | + catch (DataDepth $e) |
|
223 | 223 | { |
224 | 224 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
225 | 225 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -74,23 +74,19 @@ discard block |
||
74 | 74 | try |
75 | 75 | { |
76 | 76 | return $this->xConfigReader->read($sConfigFile); |
77 | - } |
|
78 | - catch(YamlExtension $e) |
|
77 | + } catch(YamlExtension $e) |
|
79 | 78 | { |
80 | 79 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
81 | 80 | throw new SetupException($sMessage); |
82 | - } |
|
83 | - catch(FileExtension $e) |
|
81 | + } catch(FileExtension $e) |
|
84 | 82 | { |
85 | 83 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
86 | 84 | throw new SetupException($sMessage); |
87 | - } |
|
88 | - catch(FileAccess $e) |
|
85 | + } catch(FileAccess $e) |
|
89 | 86 | { |
90 | 87 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
91 | 88 | throw new SetupException($sMessage); |
92 | - } |
|
93 | - catch(FileContent $e) |
|
89 | + } catch(FileContent $e) |
|
94 | 90 | { |
95 | 91 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
96 | 92 | throw new SetupException($sMessage); |
@@ -114,8 +110,7 @@ discard block |
||
114 | 110 | $this->xConfig->setOptions($this->read($sConfigFile), $sConfigSection); |
115 | 111 | // Call the config change listeners. |
116 | 112 | $this->xEventManager->onChange($this->xConfig, ''); |
117 | - } |
|
118 | - catch(DataDepth $e) |
|
113 | + } catch(DataDepth $e) |
|
119 | 114 | { |
120 | 115 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
121 | 116 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -143,8 +138,7 @@ discard block |
||
143 | 138 | // Call the config change listeners. |
144 | 139 | $this->xEventManager->onChange($this->xConfig, ''); |
145 | 140 | return true; |
146 | - } |
|
147 | - catch(DataDepth $e) |
|
141 | + } catch(DataDepth $e) |
|
148 | 142 | { |
149 | 143 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
150 | 144 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -218,8 +212,7 @@ discard block |
||
218 | 212 | try |
219 | 213 | { |
220 | 214 | return new Config($aOptions, $sKeys); |
221 | - } |
|
222 | - catch(DataDepth $e) |
|
215 | + } catch(DataDepth $e) |
|
223 | 216 | { |
224 | 217 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
225 | 218 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function onChange(Config $xConfig, string $sName) |
27 | 27 | { |
28 | 28 | // Set the library language any time the config is changed. |
29 | - if($sName === '' || $sName === 'core.language') |
|
29 | + if ($sName === '' || $sName === 'core.language') |
|
30 | 30 | { |
31 | 31 | $this->setLocale($xConfig->getOption('core.language')); |
32 | 32 | } |