Completed
Push — master ( 10d1fd...328428 )
by Thierry
01:57
created
src/Jaxon.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             'core.prefix.class'                 => 'Jaxon',
157 157
             // 'core.request.uri'               => '',
158 158
             'core.request.mode'                 => 'asynchronous',
159
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
159
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
160 160
             'core.response.merge.ap'            => true,
161 161
             'core.response.merge.js'            => true,
162 162
             'core.debug.on'                     => false,
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
246 246
     {
247
-        if(!$this->getOption('core.request.uri'))
247
+        if (!$this->getOption('core.request.uri'))
248 248
         {
249 249
             $this->setOption('core.request.uri', URI::detect());
250 250
         }
251 251
         $sCode = '';
252 252
         $xCodeGenerator = $this->di()->getCodeGenerator();
253
-        if(($bIncludeCss))
253
+        if (($bIncludeCss))
254 254
         {
255 255
             $sCode .= $xCodeGenerator->getCss() . "\n";
256 256
         }
257
-        if(($bIncludeJs))
257
+        if (($bIncludeJs))
258 258
         {
259 259
             $sCode .= $xCodeGenerator->getJs() . "\n";
260 260
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     public function processRequest()
326 326
     {
327 327
         // Check to see if headers have already been sent out, in which case we can't do our job
328
-        if(headers_sent($filename, $linenumber))
328
+        if (headers_sent($filename, $linenumber))
329 329
         {
330 330
             echo $this->trans('errors.output.already-sent', array(
331 331
                 'location' => $filename . ':' . $linenumber
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         }
335 335
 
336 336
         // Check if there is a plugin to process this request
337
-        if(!$this->canProcessRequest())
337
+        if (!$this->canProcessRequest())
338 338
         {
339 339
             return;
340 340
         }
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
         $xResponseManager = $this->getResponseManager();
345 345
 
346 346
         // Handle before processing event
347
-        if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
347
+        if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
348 348
         {
349 349
             $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest));
350 350
         }
351 351
 
352
-        if(!$bEndRequest)
352
+        if (!$bEndRequest)
353 353
         {
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357 357
             }
358
-            catch(Exception $e)
358
+            catch (Exception $e)
359 359
             {
360 360
                 // An exception was thrown while processing the request.
361 361
                 // The request missed the corresponding handler function,
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 $xResponseManager->debug($e->getMessage());
368 368
                 $mResult = false;
369 369
 
370
-                if($e instanceof \Jaxon\Exception\Error)
370
+                if ($e instanceof \Jaxon\Exception\Error)
371 371
                 {
372 372
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 373
                     $aParams = array($e->getMessage());
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
                     $aParams = array($e);
379 379
                 }
380 380
 
381
-                if(isset($this->aProcessingEvents[$sEvent]))
381
+                if (isset($this->aProcessingEvents[$sEvent]))
382 382
                 {
383 383
                     // Call the processing event
384 384
                     $this->aProcessingEvents[$sEvent]->call($aParams);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             }
392 392
         }
393 393
         // Clean the processing buffer
394
-        if(($this->getOption('core.process.clean')))
394
+        if (($this->getOption('core.process.clean')))
395 395
         {
396 396
             $er = error_reporting(0);
397 397
             while (ob_get_level() > 0)
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
             error_reporting($er);
402 402
         }
403 403
 
404
-        if($mResult === true)
404
+        if ($mResult === true)
405 405
         {
406 406
             // Handle after processing event
407
-            if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
407
+            if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
408 408
             {
409 409
                 $bEndRequest = false;
410 410
                 $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest));
411 411
             }
412 412
             // If the called function returned no response, give the the global response instead
413
-            if($xResponseManager->hasNoResponse())
413
+            if ($xResponseManager->hasNoResponse())
414 414
             {
415 415
                 $xResponseManager->append($this->getResponse());
416 416
             }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
         $xResponseManager->printDebug();
420 420
 
421
-        if(($this->getOption('core.process.exit')))
421
+        if (($this->getOption('core.process.exit')))
422 422
         {
423 423
             $xResponseManager->sendOutput();
424 424
             exit();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -354,8 +354,7 @@  discard block
 block discarded – undo
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357
-            }
358
-            catch(Exception $e)
357
+            } catch(Exception $e)
359 358
             {
360 359
                 // An exception was thrown while processing the request.
361 360
                 // The request missed the corresponding handler function,
@@ -371,8 +370,7 @@  discard block
 block discarded – undo
371 370
                 {
372 371
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 372
                     $aParams = array($e->getMessage());
374
-                }
375
-                else
373
+                } else
376 374
                 {
377 375
                     $sEvent = self::PROCESSING_EVENT_ERROR;
378 376
                     $aParams = array($e);
@@ -382,8 +380,7 @@  discard block
 block discarded – undo
382 380
                 {
383 381
                     // Call the processing event
384 382
                     $this->aProcessingEvents[$sEvent]->call($aParams);
385
-                }
386
-                else
383
+                } else
387 384
                 {
388 385
                     // The exception is not to be processed here.
389 386
                     throw $e;
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
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     protected function alert($message, $title)
28 28
     {
29
-        if($this->getReturn())
29
+        if ($this->getReturn())
30 30
         {
31 31
             return 'alert(' . $message . ')';
32 32
         }
Please login to merge, or discard this patch.
src/Dialog/Confirm.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 23
     public function confirm($question, $yesScript, $noScript)
24 24
     {
25
-        if(!$noScript)
25
+        if (!$noScript)
26 26
         {
27 27
             return 'if(confirm(' . $question . ')){' . $yesScript . ';}';
28 28
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
         if(!$noScript)
26 26
         {
27 27
             return 'if(confirm(' . $question . ')){' . $yesScript . ';}';
28
-        }
29
-        else
28
+        } else
30 29
         {
31 30
             return 'if(confirm(' . $question . ')){' . $yesScript . ';}else{' . $noScript . ';}';
32 31
         }
Please login to merge, or discard this patch.
src/Request/Plugin/CallableClass.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $this->xRepository = $xRepository;
62 62
 
63
-        if(!empty($_GET['jxncls']))
63
+        if (!empty($_GET['jxncls']))
64 64
         {
65 65
             $this->sRequestedClass = $_GET['jxncls'];
66 66
         }
67
-        if(!empty($_GET['jxnmthd']))
67
+        if (!empty($_GET['jxnmthd']))
68 68
         {
69 69
             $this->sRequestedMethod = $_GET['jxnmthd'];
70 70
         }
71
-        if(!empty($_POST['jxncls']))
71
+        if (!empty($_POST['jxncls']))
72 72
         {
73 73
             $this->sRequestedClass = $_POST['jxncls'];
74 74
         }
75
-        if(!empty($_POST['jxnmthd']))
75
+        if (!empty($_POST['jxnmthd']))
76 76
         {
77 77
             $this->sRequestedMethod = $_POST['jxnmthd'];
78 78
         }
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function register($sType, $sClassName, $aOptions)
101 101
     {
102
-        if($sType != $this->getName())
102
+        if ($sType != $this->getName())
103 103
         {
104 104
             return false;
105 105
         }
106 106
 
107
-        if(!is_string($sClassName))
107
+        if (!is_string($sClassName))
108 108
         {
109 109
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
110 110
         }
111
-        if(is_string($aOptions))
111
+        if (is_string($aOptions))
112 112
         {
113 113
             $aOptions = ['include' => $aOptions];
114 114
         }
115
-        if(!is_array($aOptions))
115
+        if (!is_array($aOptions))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
118 118
         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
     public function canProcessRequest()
151 151
     {
152 152
         // Check the validity of the class name
153
-        if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
153
+        if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
154 154
         {
155 155
             $this->sRequestedClass = null;
156 156
             $this->sRequestedMethod = null;
157 157
         }
158 158
         // Check the validity of the method name
159
-        if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
159
+        if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
160 160
         {
161 161
             $this->sRequestedClass = null;
162 162
             $this->sRequestedMethod = null;
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function processRequest()
173 173
     {
174
-        if(!$this->canProcessRequest())
174
+        if (!$this->canProcessRequest())
175 175
         {
176 176
             return false;
177 177
         }
178 178
 
179 179
         // Find the requested method
180 180
         $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass);
181
-        if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
181
+        if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
182 182
         {
183 183
             // Unable to find the requested object or method
184 184
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $jaxon = jaxon();
190 190
         $aArgs = $jaxon->getRequestHandler()->processArguments();
191 191
         $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs);
192
-        if(($xResponse))
192
+        if (($xResponse))
193 193
         {
194 194
             $jaxon->getResponseManager()->append($xResponse);
195 195
         }
Please login to merge, or discard this patch.