Passed
Push — master ( 8967d6...43e8ba )
by Thierry
02:33
created
src/App/Dialog/Library/DialogLibraryManager.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function registerLibrary(string $sClassName, string $sLibraryName)
108 108
     {
109
-        if(isset($this->aLibraries[$sLibraryName]))
109
+        if (isset($this->aLibraries[$sLibraryName]))
110 110
         {
111 111
             return;
112 112
         }
113
-        if(!($aInterfaces = class_implements($sClassName)))
113
+        if (!($aInterfaces = class_implements($sClassName)))
114 114
         {
115 115
             // The class is invalid.
116 116
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $bIsQuestion = in_array(QuestionInterface::class, $aInterfaces);
121 121
         $bIsMessage = in_array(MessageInterface::class, $aInterfaces);
122 122
         $bIsModal = in_array(ModalInterface::class, $aInterfaces);
123
-        if(!$bIsQuestion && !$bIsMessage && !$bIsModal)
123
+        if (!$bIsQuestion && !$bIsMessage && !$bIsModal)
124 124
         {
125 125
             // The class is invalid.
126 126
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function setQuestionLibrary(string $sLibraryName)
150 150
     {
151
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question'])
151
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question'])
152 152
         {
153 153
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
154 154
                 ['type' => 'question', 'name' => $sLibraryName]);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function setMessageLibrary(string $sLibraryName)
179 179
     {
180
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message'])
180
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message'])
181 181
         {
182 182
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
183 183
                 ['type' => 'message', 'name' => $sLibraryName]);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function setModalLibrary(string $sLibraryName)
208 208
     {
209
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
209
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
210 210
         {
211 211
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
212 212
                 ['type' => 'modal', 'name' => $sLibraryName]);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     protected function registerLibraries()
247 247
     {
248 248
         $aLibraries = $this->xConfigManager->getOption('dialogs.libraries', []);
249
-        foreach($aLibraries as $sLibraryName => $sClassName)
249
+        foreach ($aLibraries as $sLibraryName => $sClassName)
250 250
         {
251 251
             $this->registerLibrary($sClassName, $sLibraryName);
252 252
         }
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
     protected function setDefaultLibraries()
262 262
     {
263 263
         // Set the default modal library
264
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', '')))
264
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', '')))
265 265
         {
266 266
             $this->setModalLibrary($sLibraryName);
267 267
             $this->aLibraries[$sLibraryName]['used'] = true;
268 268
         }
269 269
         // Set the default message library
270
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', '')))
270
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', '')))
271 271
         {
272 272
             $this->setMessageLibrary($sLibraryName);
273 273
             $this->aLibraries[$sLibraryName]['used'] = true;
274 274
         }
275 275
         // Set the default question library
276
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', '')))
276
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', '')))
277 277
         {
278 278
             $this->setQuestionLibrary($sLibraryName);
279 279
             $this->aLibraries[$sLibraryName]['used'] = true;
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
     {
291 291
         // Set the other libraries in use
292 292
         $aLibraries = $this->xConfigManager->getOption('dialogs.used', []);
293
-        foreach($aLibraries as $sLibraryName)
293
+        foreach ($aLibraries as $sLibraryName)
294 294
         {
295
-            if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
295
+            if (isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
296 296
             {
297 297
                 $this->aLibraries[$sLibraryName]['used'] = true;
298 298
             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      */
322 322
     public function onChange(Config $xConfig, string $sName)
323 323
     {
324
-        if($sName === '')
324
+        if ($sName === '')
325 325
         {
326 326
             // Reset the default libraries any time the config is changed.
327 327
             $this->registerLibraries();
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
             $this->setUsedLibraries();
330 330
             return;
331 331
         }
332
-        if(substr($sName, 0, 17) === 'dialogs.libraries')
332
+        if (substr($sName, 0, 17) === 'dialogs.libraries')
333 333
         {
334 334
             $this->registerLibraries();
335 335
             return;
336 336
         }
337
-        if(substr($sName, 0, 15) === 'dialogs.default')
337
+        if (substr($sName, 0, 15) === 'dialogs.default')
338 338
         {
339 339
             $this->setDefaultLibraries();
340 340
         }
341
-        if(substr($sName, 0, 12) === 'dialogs.used')
341
+        if (substr($sName, 0, 12) === 'dialogs.used')
342 342
         {
343 343
             $this->setUsedLibraries();
344 344
             return;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -292,10 +292,12 @@
 block discarded – undo
292 292
         $aLibraries = $this->xConfigManager->getOption('dialogs.used', []);
293 293
         foreach($aLibraries as $sLibraryName)
294 294
         {
295
-            if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
295
+            if(isset($this->aLibraries[$sLibraryName])) {
296
+                // Make sure the library exists
296 297
             {
297 298
                 $this->aLibraries[$sLibraryName]['used'] = true;
298 299
             }
300
+            }
299 301
         }
300 302
     }
301 303
 
Please login to merge, or discard this patch.