Completed
Push — master ( 5d7b0f...8d92ea )
by Thierry
03:20
created
src/Plugin/Manager.php 2 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -136,13 +136,11 @@  discard block
 block discarded – undo
136 136
         {
137 137
             // The name of a request plugin is used as key in the plugin table
138 138
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
139
-        }
140
-        elseif($xPlugin instanceof Response)
139
+        } elseif($xPlugin instanceof Response)
141 140
         {
142 141
             // The name of a response plugin is used as key in the plugin table
143 142
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
144
-        }
145
-        elseif(!$bIsConfirm && !$bIsAlert)
143
+        } elseif(!$bIsConfirm && !$bIsAlert)
146 144
         {
147 145
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]));
148 146
         }
@@ -226,13 +224,11 @@  discard block
 block discarded – undo
226 224
             {
227 225
                 // Register a function without options
228 226
                 $this->register(Jaxon::USER_FUNCTION, $xValue);
229
-            }
230
-            elseif(is_string($xKey) && is_array($xValue))
227
+            } elseif(is_string($xKey) && is_array($xValue))
231 228
             {
232 229
                 // Register a function with options
233 230
                 $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
234
-            }
235
-            else
231
+            } else
236 232
             {
237 233
                 continue;
238 234
                 // Todo: throw an exception
@@ -247,13 +243,11 @@  discard block
 block discarded – undo
247 243
             {
248 244
                 // Register a class without options
249 245
                 $this->register(Jaxon::CALLABLE_CLASS, $xValue);
250
-            }
251
-            elseif(is_string($xKey) && is_array($xValue))
246
+            } elseif(is_string($xKey) && is_array($xValue))
252 247
             {
253 248
                 // Register a class with options
254 249
                 $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
255
-            }
256
-            elseif(is_integer($xKey) && is_array($xValue))
250
+            } elseif(is_integer($xKey) && is_array($xValue))
257 251
             {
258 252
                 // The directory path is required
259 253
                 if(!key_exists('directory', $xValue))
@@ -280,8 +274,7 @@  discard block
 block discarded – undo
280 274
                 }
281 275
                 // Register a class without options
282 276
                 $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions);
283
-            }
284
-            else
277
+            } else
285 278
             {
286 279
                 continue;
287 280
                 // Todo: throw an exception
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -132,32 +132,32 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $bIsAlert = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Alert);
134 134
         $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Confirm);
135
-        if($xPlugin instanceof Request)
135
+        if ($xPlugin instanceof Request)
136 136
         {
137 137
             // The name of a request plugin is used as key in the plugin table
138 138
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
139 139
         }
140
-        elseif($xPlugin instanceof Response)
140
+        elseif ($xPlugin instanceof Response)
141 141
         {
142 142
             // The name of a response plugin is used as key in the plugin table
143 143
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
144 144
         }
145
-        elseif(!$bIsConfirm && !$bIsAlert)
145
+        elseif (!$bIsConfirm && !$bIsAlert)
146 146
         {
147 147
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]));
148 148
         }
149 149
         // This plugin implements the Alert interface
150
-        if($bIsAlert)
150
+        if ($bIsAlert)
151 151
         {
152 152
             jaxon()->dialog()->setAlert($xPlugin);
153 153
         }
154 154
         // This plugin implements the Confirm interface
155
-        if($bIsConfirm)
155
+        if ($bIsConfirm)
156 156
         {
157 157
             jaxon()->dialog()->setConfirm($xPlugin);
158 158
         }
159 159
         // Register the plugin as an event listener
160
-        if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
160
+        if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
161 161
         {
162 162
             $this->addEventListener($xPlugin);
163 163
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function register($sType, $sCallable, $aOptions = [])
194 194
     {
195
-        if(!key_exists($sType, $this->aRequestPlugins))
195
+        if (!key_exists($sType, $this->aRequestPlugins))
196 196
         {
197 197
             throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType]));
198 198
         }
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
     {
221 221
         // Register user functions
222 222
         $aFunctionsConfig = $xAppConfig->getOption('functions', []);
223
-        foreach($aFunctionsConfig as $xKey => $xValue)
223
+        foreach ($aFunctionsConfig as $xKey => $xValue)
224 224
         {
225
-            if(is_integer($xKey) && is_string($xValue))
225
+            if (is_integer($xKey) && is_string($xValue))
226 226
             {
227 227
                 // Register a function without options
228 228
                 $this->register(Jaxon::USER_FUNCTION, $xValue);
229 229
             }
230
-            elseif(is_string($xKey) && is_array($xValue))
230
+            elseif (is_string($xKey) && is_array($xValue))
231 231
             {
232 232
                 // Register a function with options
233 233
                 $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
@@ -241,22 +241,22 @@  discard block
 block discarded – undo
241 241
 
242 242
         // Register classes and directories
243 243
         $aClassesConfig = $xAppConfig->getOption('classes', []);
244
-        foreach($aClassesConfig as $xKey => $xValue)
244
+        foreach ($aClassesConfig as $xKey => $xValue)
245 245
         {
246
-            if(is_integer($xKey) && is_string($xValue))
246
+            if (is_integer($xKey) && is_string($xValue))
247 247
             {
248 248
                 // Register a class without options
249 249
                 $this->register(Jaxon::CALLABLE_CLASS, $xValue);
250 250
             }
251
-            elseif(is_string($xKey) && is_array($xValue))
251
+            elseif (is_string($xKey) && is_array($xValue))
252 252
             {
253 253
                 // Register a class with options
254 254
                 $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
255 255
             }
256
-            elseif(is_integer($xKey) && is_array($xValue))
256
+            elseif (is_integer($xKey) && is_array($xValue))
257 257
             {
258 258
                 // The directory path is required
259
-                if(!key_exists('directory', $xValue))
259
+                if (!key_exists('directory', $xValue))
260 260
                 {
261 261
                     continue;
262 262
                     // Todo: throw an exception
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
                 // Registering a directory
265 265
                 $sDirectory = $xValue['directory'];
266 266
                 $aOptions = [];
267
-                if(key_exists('options', $xValue) &&
267
+                if (key_exists('options', $xValue) &&
268 268
                     (is_array($xValue['options']) || is_string($xValue['options'])))
269 269
                 {
270 270
                     $aOptions = $xValue['options'];
271 271
                 }
272 272
                 // Setup directory options
273
-                if(key_exists('namespace', $xValue))
273
+                if (key_exists('namespace', $xValue))
274 274
                 {
275 275
                     $aOptions['namespace'] = $xValue['namespace'];
276 276
                 }
277
-                if(key_exists('separator', $xValue))
277
+                if (key_exists('separator', $xValue))
278 278
                 {
279 279
                     $aOptions['separator'] = $xValue['separator'];
280 280
                 }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function getResponsePlugin($sName)
301 301
     {
302
-        if(array_key_exists($sName, $this->aResponsePlugins))
302
+        if (array_key_exists($sName, $this->aResponsePlugins))
303 303
         {
304 304
             return $this->aResponsePlugins[$sName];
305 305
         }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      */
316 316
     public function getRequestPlugin($sName)
317 317
     {
318
-        if(array_key_exists($sName, $this->aRequestPlugins))
318
+        if (array_key_exists($sName, $this->aRequestPlugins))
319 319
         {
320 320
             return $this->aRequestPlugins[$sName];
321 321
         }
Please login to merge, or discard this patch.
src/Dialog/Alert.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     protected function alert($message, $title)
28 28
     {
29 29
         $title = ''; // Not used.
30
-        if($this->getReturn())
30
+        if ($this->getReturn())
31 31
         {
32 32
             return 'alert(' . $title . $message . ')';
33 33
         }
Please login to merge, or discard this patch.