@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private function setHookMethods(array &$aHookMethods, $xValue) |
186 | 186 | { |
187 | - foreach($xValue as $sCalledMethod => $xMethodToCall) |
|
187 | + foreach ($xValue as $sCalledMethod => $xMethodToCall) |
|
188 | 188 | { |
189 | - if(is_array($xMethodToCall)) |
|
189 | + if (is_array($xMethodToCall)) |
|
190 | 190 | { |
191 | 191 | $aHookMethods[$sCalledMethod] = $xMethodToCall; |
192 | 192 | } |
193 | - elseif(is_string($xMethodToCall)) |
|
193 | + elseif (is_string($xMethodToCall)) |
|
194 | 194 | { |
195 | 195 | $aHookMethods[$sCalledMethod] = [$xMethodToCall]; |
196 | 196 | } |
@@ -207,18 +207,18 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function configure(string $sName, $xValue) |
209 | 209 | { |
210 | - switch($sName) |
|
210 | + switch ($sName) |
|
211 | 211 | { |
212 | 212 | // Set the separator |
213 | 213 | case 'separator': |
214 | - if($xValue === '_' || $xValue === '.') |
|
214 | + if ($xValue === '_' || $xValue === '.') |
|
215 | 215 | { |
216 | 216 | $this->sSeparator = $xValue; |
217 | 217 | } |
218 | 218 | break; |
219 | 219 | // Set the protected methods |
220 | 220 | case 'protected': |
221 | - if(is_array($xValue)) |
|
221 | + if (is_array($xValue)) |
|
222 | 222 | { |
223 | 223 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $this->aAttributes = array_merge($this->aAttributes, $xValue); |
237 | 237 | break; |
238 | 238 | case 'excluded': |
239 | - $this->bExcluded = (bool)$xValue; |
|
239 | + $this->bExcluded = (bool) $xValue; |
|
240 | 240 | break; |
241 | 241 | default: |
242 | 242 | break; |
@@ -358,16 +358,16 @@ discard block |
||
358 | 358 | // $aMethods = $aHookMethods[$sMethod] ?? $aHookMethods['*'] ?? []; |
359 | 359 | // The hooks defined at method level are merged with those defined at class level. |
360 | 360 | $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []); |
361 | - foreach($aMethods as $xKey => $xValue) |
|
361 | + foreach ($aMethods as $xKey => $xValue) |
|
362 | 362 | { |
363 | 363 | $sMethodName = $xValue; |
364 | 364 | $aMethodArgs = []; |
365 | - if(is_string($xKey)) |
|
365 | + if (is_string($xKey)) |
|
366 | 366 | { |
367 | 367 | $sMethodName = $xKey; |
368 | 368 | $aMethodArgs = is_array($xValue) ? $xValue : [$xValue]; |
369 | 369 | // The parameters of the method can be passed to the hooks. |
370 | - if(count($aMethodArgs) > 0 && $aMethodArgs[0] === '__params__') |
|
370 | + if (count($aMethodArgs) > 0 && $aMethodArgs[0] === '__params__') |
|
371 | 371 | { |
372 | 372 | $aMethodArgs[0] = $aArgs; |
373 | 373 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // $aAttributes = $this->aAttributes[$sMethod] ?? $this->aAttributes['*'] ?? []; |
396 | 396 | // The attributes defined at method level are merged with those defined at class level. |
397 | 397 | $aAttributes = array_merge($this->aAttributes['*'] ?? [], $this->aAttributes[$sMethod] ?? []); |
398 | - foreach($aAttributes as $sName => $sClass) |
|
398 | + foreach ($aAttributes as $sName => $sClass) |
|
399 | 399 | { |
400 | 400 | // Set the protected attributes of the object |
401 | 401 | $cSetter = function($c) use($sClass, $sName) { |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | { |
124 | 124 | $bIsUsed = false; |
125 | 125 | $aInterfaces = class_implements($sClassName); |
126 | - if(in_array(QuestionInterface::class, $aInterfaces)) |
|
126 | + if (in_array(QuestionInterface::class, $aInterfaces)) |
|
127 | 127 | { |
128 | 128 | $this->aQuestionLibraries[$sLibraryName] = $bIsUsed = true; |
129 | 129 | } |
130 | - if(in_array(MessageInterface::class, $aInterfaces)) |
|
130 | + if (in_array(MessageInterface::class, $aInterfaces)) |
|
131 | 131 | { |
132 | 132 | $this->aMessageLibraries[$sLibraryName] = $bIsUsed = true; |
133 | 133 | } |
134 | - if(in_array(ModalInterface::class, $aInterfaces)) |
|
134 | + if (in_array(ModalInterface::class, $aInterfaces)) |
|
135 | 135 | { |
136 | 136 | $this->aModalLibraries[$sLibraryName] = $bIsUsed = true; |
137 | 137 | } |
138 | - if(!$bIsUsed) |
|
138 | + if (!$bIsUsed) |
|
139 | 139 | { |
140 | 140 | // The class is invalid. |
141 | 141 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function setQuestionLibrary(string $sLibraryName) |
169 | 169 | { |
170 | - if(!isset($this->aQuestionLibraries[$sLibraryName])) |
|
170 | + if (!isset($this->aQuestionLibraries[$sLibraryName])) |
|
171 | 171 | { |
172 | 172 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
173 | 173 | ['type' => 'question', 'name' => $sLibraryName]); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function setMessageLibrary(string $sLibraryName) |
199 | 199 | { |
200 | - if(!isset($this->aMessageLibraries[$sLibraryName])) |
|
200 | + if (!isset($this->aMessageLibraries[$sLibraryName])) |
|
201 | 201 | { |
202 | 202 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
203 | 203 | ['type' => 'message', 'name' => $sLibraryName]); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function setModalLibrary(string $sLibraryName) |
229 | 229 | { |
230 | - if(!isset($this->aModalLibraries[$sLibraryName])) |
|
230 | + if (!isset($this->aModalLibraries[$sLibraryName])) |
|
231 | 231 | { |
232 | 232 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
233 | 233 | ['type' => 'modal', 'name' => $sLibraryName]); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | protected function registerLibraries() |
269 | 269 | { |
270 | 270 | $aLibraries = $this->xConfigManager->getOption('dialogs.classes', []); |
271 | - foreach($aLibraries as $sLibraryName => $sClassName) |
|
271 | + foreach ($aLibraries as $sLibraryName => $sClassName) |
|
272 | 272 | { |
273 | 273 | $this->registerLibrary($sClassName, $sLibraryName); |
274 | 274 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | protected function updateLibraries() |
283 | 283 | { |
284 | 284 | $aLibraries = $this->xConfigManager->getOption('dialogs.libraries', []); |
285 | - foreach($aLibraries as $sLibraryName) |
|
285 | + foreach ($aLibraries as $sLibraryName) |
|
286 | 286 | { |
287 | 287 | $this->aLibraries[$sLibraryName] = true; |
288 | 288 | } |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | protected function setDefaultLibraries() |
298 | 298 | { |
299 | 299 | // Set the default modal library |
300 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
300 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
301 | 301 | { |
302 | 302 | $this->setModalLibrary($sLibraryName); |
303 | 303 | } |
304 | 304 | // Set the default message library |
305 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
305 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
306 | 306 | { |
307 | 307 | $this->setMessageLibrary($sLibraryName); |
308 | 308 | } |
309 | 309 | // Set the default question library |
310 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
310 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
311 | 311 | { |
312 | 312 | $this->setQuestionLibrary($sLibraryName); |
313 | 313 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function onChange(Config $xConfig, string $sName) |
321 | 321 | { |
322 | - if($sName === '') |
|
322 | + if ($sName === '') |
|
323 | 323 | { |
324 | 324 | // Reset the default libraries any time the config is changed. |
325 | 325 | $this->registerLibraries(); |
@@ -327,17 +327,17 @@ discard block |
||
327 | 327 | $this->setDefaultLibraries(); |
328 | 328 | return; |
329 | 329 | } |
330 | - if(substr($sName, 0, 15) === 'dialogs.classes') |
|
330 | + if (substr($sName, 0, 15) === 'dialogs.classes') |
|
331 | 331 | { |
332 | 332 | $this->registerLibraries(); |
333 | 333 | return; |
334 | 334 | } |
335 | - if($sName === 'dialogs.libraries') |
|
335 | + if ($sName === 'dialogs.libraries') |
|
336 | 336 | { |
337 | 337 | $this->updateLibraries(); |
338 | 338 | return; |
339 | 339 | } |
340 | - if(substr($sName, 0, 15) === 'dialogs.default') |
|
340 | + if (substr($sName, 0, 15) === 'dialogs.default') |
|
341 | 341 | { |
342 | 342 | $this->setDefaultLibraries(); |
343 | 343 | } |
@@ -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 | } |