Completed
Push — master ( 859b6d...c8dd9a )
by Thierry
01:30
created
src/Utils/Http/URI.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $aURL = [];
27 27
         // Try to get the request URL
28
-        if(!empty($_SERVER['REQUEST_URI']))
28
+        if (!empty($_SERVER['REQUEST_URI']))
29 29
         {
30
-            $_SERVER['REQUEST_URI'] = str_replace(['"',"'",'<','>'], ['%22','%27','%3C','%3E'], $_SERVER['REQUEST_URI']);
30
+            $_SERVER['REQUEST_URI'] = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $_SERVER['REQUEST_URI']);
31 31
             $aURL = parse_url($_SERVER['REQUEST_URI']);
32 32
         }
33 33
 
34 34
         // Fill in the empty values
35
-        if(empty($aURL['scheme']))
35
+        if (empty($aURL['scheme']))
36 36
         {
37
-            if(!empty($_SERVER['HTTP_SCHEME']))
37
+            if (!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40 40
             }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
             }
45 45
         }
46 46
 
47
-        if(empty($aURL['host']))
47
+        if (empty($aURL['host']))
48 48
         {
49
-            if(!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
49
+            if (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
50 50
             {
51
-                if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
51
+                if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 52
                 {
53 53
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54 54
                 }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 58
                 }
59 59
             }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
60
+            elseif (!empty($_SERVER['HTTP_HOST']))
61 61
             {
62
-                if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
62
+                if (strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 63
                 {
64 64
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65 65
                 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 69
                 }
70 70
             }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
71
+            elseif (!empty($_SERVER['SERVER_NAME']))
72 72
             {
73 73
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74 74
             }
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
             }
79 79
         }
80 80
 
81
-        if(empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
81
+        if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
82 82
         {
83 83
             $aURL['port'] = $_SERVER['SERVER_PORT'];
84 84
         }
85 85
 
86
-        if(!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
86
+        if (!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
87 87
         {
88 88
             unset($aURL['path']);
89 89
         }
90 90
 
91
-        if(empty($aURL['path']))
91
+        if (empty($aURL['path']))
92 92
         {
93
-            if(!empty($_SERVER['PATH_INFO']))
93
+            if (!empty($_SERVER['PATH_INFO']))
94 94
             {
95 95
                 $sPath = parse_url($_SERVER['PATH_INFO']);
96 96
             }
@@ -98,61 +98,61 @@  discard block
 block discarded – undo
98 98
             {
99 99
                 $sPath = parse_url($_SERVER['PHP_SELF']);
100 100
             }
101
-            if(isset($sPath['path']))
101
+            if (isset($sPath['path']))
102 102
             {
103
-                $aURL['path'] = str_replace(['"',"'",'<','>'], ['%22','%27','%3C','%3E'], $sPath['path']);
103
+                $aURL['path'] = str_replace(['"', "'", '<', '>'], ['%22', '%27', '%3C', '%3E'], $sPath['path']);
104 104
             }
105 105
             unset($sPath);
106 106
         }
107 107
 
108
-        if(empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
108
+        if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
109 109
         {
110 110
             $aURL['query'] = $_SERVER['QUERY_STRING'];
111 111
         }
112 112
 
113
-        if(!empty($aURL['query']))
113
+        if (!empty($aURL['query']))
114 114
         {
115
-            $aURL['query'] = '?'.$aURL['query'];
115
+            $aURL['query'] = '?' . $aURL['query'];
116 116
         }
117 117
 
118 118
         // Build the URL: Start with scheme, user and pass
119
-        $sURL = $aURL['scheme'].'://';
120
-        if(!empty($aURL['user']))
119
+        $sURL = $aURL['scheme'] . '://';
120
+        if (!empty($aURL['user']))
121 121
         {
122
-            $sURL.= $aURL['user'];
123
-            if(!empty($aURL['pass']))
122
+            $sURL .= $aURL['user'];
123
+            if (!empty($aURL['pass']))
124 124
             {
125
-                $sURL.= ':'.$aURL['pass'];
125
+                $sURL .= ':' . $aURL['pass'];
126 126
             }
127
-            $sURL.= '@';
127
+            $sURL .= '@';
128 128
         }
129 129
 
130 130
         // Add the host
131
-        $sURL.= $aURL['host'];
131
+        $sURL .= $aURL['host'];
132 132
 
133 133
         // Add the port if needed
134
-        if(!empty($aURL['port'])
134
+        if (!empty($aURL['port'])
135 135
                 && (($aURL['scheme'] == 'http' && $aURL['port'] != 80)
136 136
                         || ($aURL['scheme'] == 'https' && $aURL['port'] != 443)))
137 137
         {
138
-            $sURL.= ':'.$aURL['port'];
138
+            $sURL .= ':' . $aURL['port'];
139 139
         }
140 140
 
141 141
         // Add the path and the query string
142
-        $sURL.= $aURL['path'].@$aURL['query'];
142
+        $sURL .= $aURL['path'] . @$aURL['query'];
143 143
 
144 144
         // Clean up
145 145
         unset($aURL);
146 146
 
147 147
         $aURL = explode("?", $sURL);
148 148
 
149
-        if(1 < count($aURL))
149
+        if (1 < count($aURL))
150 150
         {
151 151
             $aQueries = explode("&", $aURL[1]);
152 152
 
153
-            foreach($aQueries as $sKey => $sQuery)
153
+            foreach ($aQueries as $sKey => $sQuery)
154 154
             {
155
-                if("jxnGenerate" == substr($sQuery, 0, 11))
155
+                if ("jxnGenerate" == substr($sQuery, 0, 11))
156 156
                     unset($aQueries[$sKey]);
157 157
             }
158 158
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
             if(!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40
-            }
41
-            else
40
+            } else
42 41
             {
43 42
                 $aURL['scheme'] = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http');
44 43
             }
@@ -51,28 +50,23 @@  discard block
 block discarded – undo
51 50
                 if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 51
                 {
53 52
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54
-                }
55
-                else
53
+                } else
56 54
                 {
57 55
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 56
                 }
59
-            }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
57
+            } elseif(!empty($_SERVER['HTTP_HOST']))
61 58
             {
62 59
                 if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 60
                 {
64 61
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65
-                }
66
-                else
62
+                } else
67 63
                 {
68 64
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 65
                 }
70
-            }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
66
+            } elseif(!empty($_SERVER['SERVER_NAME']))
72 67
             {
73 68
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74
-            }
75
-            else
69
+            } else
76 70
             {
77 71
                 throw new \Jaxon\Exception\URI();
78 72
             }
@@ -94,8 +88,7 @@  discard block
 block discarded – undo
94 88
             if(!empty($_SERVER['PATH_INFO']))
95 89
             {
96 90
                 $sPath = parse_url($_SERVER['PATH_INFO']);
97
-            }
98
-            else
91
+            } else
99 92
             {
100 93
                 $sPath = parse_url($_SERVER['PHP_SELF']);
101 94
             }
@@ -153,8 +146,9 @@  discard block
 block discarded – undo
153 146
         
154 147
             foreach($aQueries as $sKey => $sQuery)
155 148
             {
156
-                if("jxnGenerate" == substr($sQuery, 0, 11))
157
-                    unset($aQueries[$sKey]);
149
+                if("jxnGenerate" == substr($sQuery, 0, 11)) {
150
+                                    unset($aQueries[$sKey]);
151
+                }
158 152
             }
159 153
                 
160 154
             $sQueries = implode("&", $aQueries);
Please login to merge, or discard this patch.
src/Utils/Dialogs/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/Utils/Dialogs/Alert.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      */
26 26
     protected function alert($message)
27 27
     {
28
-        if($this->getReturn())
28
+        if ($this->getReturn())
29 29
         {
30 30
             return 'alert(' . $message . ')';
31 31
         }
Please login to merge, or discard this patch.
src/Response/Response.php 3 patches
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -169,20 +169,17 @@  discard block
 block discarded – undo
169 169
                             $aLastCommand['cmd'] == 'js')
170 170
                     {
171 171
                         $mData = $aLastCommand['data'].'; '.$mData;
172
-                    }
173
-                    elseif($this->getOption('core.response.merge.ap') &&
172
+                    } elseif($this->getOption('core.response.merge.ap') &&
174 173
                             $aLastCommand['cmd'] == 'ap' &&
175 174
                             $aLastCommand['id'] == $aAttributes['id'] &&
176 175
                             $aLastCommand['prop'] == $aAttributes['prop'])
177 176
                     {
178 177
                         $mData = $aLastCommand['data'].' '.$mData;
179
-                    }
180
-                    else
178
+                    } else
181 179
                     {
182 180
                         $this->aCommands[] = $aLastCommand;
183 181
                     }
184
-                }
185
-                else
182
+                } else
186 183
                 {
187 184
                     $this->aCommands[] = $aLastCommand;
188 185
                 }
@@ -237,12 +234,10 @@  discard block
 block discarded – undo
237 234
         {
238 235
             $this->returnValue = $mCommands->returnValue;
239 236
             $aCommands = $mCommands->aCommands;
240
-        }
241
-        elseif(is_array($mCommands))
237
+        } elseif(is_array($mCommands))
242 238
         {
243 239
             $aCommands = $mCommands;
244
-        }
245
-        else
240
+        } else
246 241
         {
247 242
             if(!empty($mCommands))
248 243
             {
@@ -255,8 +250,7 @@  discard block
 block discarded – undo
255 250
             if($bBefore)
256 251
             {
257 252
                 $this->aCommands = array_merge($aCommands, $this->aCommands);
258
-            }
259
-            else
253
+            } else
260 254
             {
261 255
                 $this->aCommands = array_merge($this->aCommands, $aCommands);
262 256
             }
@@ -534,8 +528,9 @@  discard block
 block discarded – undo
534 528
         {
535 529
             $queryStart++;
536 530
             $queryEnd = strpos($sURL, '#', $queryStart);
537
-            if($queryEnd === false)
538
-                $queryEnd = strlen($sURL);
531
+            if($queryEnd === false) {
532
+                            $queryEnd = strlen($sURL);
533
+            }
539 534
             $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
540 535
             parse_str($queryPart, $queryParts);
541 536
             $newQueryPart = "";
@@ -544,10 +539,11 @@  discard block
 block discarded – undo
544 539
                 $first = true;
545 540
                 foreach($queryParts as $key => $value)
546 541
                 {
547
-                    if($first)
548
-                        $first = false;
549
-                    else
550
-                        $newQueryPart .= '&';
542
+                    if($first) {
543
+                                            $first = false;
544
+                    } else {
545
+                                            $newQueryPart .= '&';
546
+                    }
551 547
                     $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
552 548
                 }
553 549
             } elseif($_SERVER['QUERY_STRING']) {
@@ -558,10 +554,11 @@  discard block
 block discarded – undo
558 554
                 }
559 555
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
560 556
         }
561
-        if($iDelay)
562
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
563
-        else
564
-            $this->script('window.location = "' . $sURL . '";');
557
+        if($iDelay) {
558
+                    $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
559
+        } else {
560
+                    $this->script('window.location = "' . $sURL . '";');
561
+        }
565 562
         return $this;
566 563
     }
567 564
 
@@ -896,11 +893,13 @@  discard block
 block discarded – undo
896 893
     {
897 894
         $command = ['cmd'  =>  'in'];
898 895
 
899
-        if(($sType))
900
-            $command['type'] = trim((string)$sType, " \t");
896
+        if(($sType)) {
897
+                    $command['type'] = trim((string)$sType, " \t");
898
+        }
901 899
 
902
-        if(($sId))
903
-            $command['elm_id'] = trim((string)$sId, " \t");
900
+        if(($sId)) {
901
+                    $command['elm_id'] = trim((string)$sId, " \t");
902
+        }
904 903
 
905 904
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
906 905
     }
@@ -917,11 +916,13 @@  discard block
 block discarded – undo
917 916
     {
918 917
         $command = ['cmd' => 'ino'];
919 918
 
920
-        if(($sType))
921
-            $command['type'] = trim((string)$sType, " \t");
919
+        if(($sType)) {
920
+                    $command['type'] = trim((string)$sType, " \t");
921
+        }
922 922
 
923
-        if(($sId))
924
-            $command['elm_id'] = trim((string)$sId, " \t");
923
+        if(($sId)) {
924
+                    $command['elm_id'] = trim((string)$sId, " \t");
925
+        }
925 926
 
926 927
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
927 928
     }
@@ -961,8 +962,9 @@  discard block
 block discarded – undo
961 962
     {
962 963
         $command = ['cmd' => 'css'];
963 964
 
964
-        if(($sMedia))
965
-            $command['media'] = trim((string)$sMedia, " \t");
965
+        if(($sMedia)) {
966
+                    $command['media'] = trim((string)$sMedia, " \t");
967
+        }
966 968
 
967 969
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
968 970
     }
@@ -980,8 +982,9 @@  discard block
 block discarded – undo
980 982
     {
981 983
         $command = ['cmd' => 'rcss'];
982 984
 
983
-        if(($sMedia))
984
-            $command['media'] = trim((string)$sMedia, " \t");
985
+        if(($sMedia)) {
986
+                    $command['media'] = trim((string)$sMedia, " \t");
987
+        }
985 988
 
986 989
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
987 990
     }
@@ -1121,11 +1124,13 @@  discard block
 block discarded – undo
1121 1124
     {
1122 1125
         $command = ['cmd' => 'DRC'];
1123 1126
 
1124
-        if(($skip))
1125
-            $command['skip'] = $skip;
1127
+        if(($skip)) {
1128
+                    $command['skip'] = $skip;
1129
+        }
1126 1130
 
1127
-        if(($remove))
1128
-            $command['remove'] = $remove;
1131
+        if(($remove)) {
1132
+                    $command['remove'] = $remove;
1133
+        }
1129 1134
 
1130 1135
         return $this->addCommand($command, $parent);
1131 1136
     }
Please login to merge, or discard this patch.
Doc Comments   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     /**
198 198
      * Clear all the commands already added to the response
199 199
      *
200
-     * @return \Jaxon\Plugin\Response
200
+     * @return Response
201 201
      */
202 202
     public function clearCommands()
203 203
     {
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
      *
212 212
      * @param \Jaxon\Plugin\Plugin  $xPlugin            The plugin object
213 213
      * @param array                 $aAttributes        The attributes for this response command
214
-     * @param mixed                 $mData              The data to be sent with this command
214
+     * @param string                 $mData              The data to be sent with this command
215 215
      *
216
-     * @return \Jaxon\Plugin\Response
216
+     * @return ResponseContract
217 217
      */
218 218
     public function addPluginCommand($xPlugin, $aAttributes, $mData)
219 219
     {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param integer        $iCmdNumber            The number of commands to skip upon cancel
273 273
      * @param string        $sMessage            The message to display to the user
274 274
      *
275
-     * @return \Jaxon\Plugin\Response
275
+     * @return ResponseContract
276 276
      */
277 277
     public function confirmCommands($iCmdNumber, $sMessage)
278 278
     {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      * @param string        $sAttribute           The attribute to be assigned
293 293
      * @param string        $sData                The value to be assigned to the attribute
294 294
      *
295
-     * @return \Jaxon\Plugin\Response
295
+     * @return ResponseContract
296 296
      */
297 297
     public function assign($sTarget, $sAttribute, $sData)
298 298
     {
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @param string        $sTarget              The id of the html element on the browser
315 315
      * @param string        $sData                The value to be assigned to the attribute
316 316
      *
317
-     * @return \Jaxon\Plugin\Response
317
+     * @return ResponseContract
318 318
      */
319 319
     public function html($sTarget, $sData)
320 320
     {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @param string        $sAttribute            The name of the attribute to be appended to
329 329
      * @param string        $sData                The data to be appended to the attribute
330 330
      *
331
-     * @return \Jaxon\Plugin\Response
331
+     * @return ResponseContract
332 332
      */
333 333
     public function append($sTarget, $sAttribute, $sData)
334 334
     {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      * @param string        $sAttribute            The name of the attribute to be prepended to
350 350
      * @param string        $sData                The value to be prepended to the attribute
351 351
      *
352
-     * @return \Jaxon\Plugin\Response
352
+     * @return ResponseContract
353 353
      */
354 354
     public function prepend($sTarget, $sAttribute, $sData)
355 355
     {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      * @param string        $sSearch            The needle to search for
372 372
      * @param string        $sData                The data to use in place of the needle
373 373
      *
374
-     * @return \Jaxon\Plugin\Response
374
+     * @return ResponseContract
375 375
      */
376 376
     public function replace($sTarget, $sAttribute, $sSearch, $sData)
377 377
     {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      * @param string        $sTarget            The id of the element to be updated.
395 395
      * @param string        $sAttribute            The attribute to be cleared
396 396
      *
397
-     * @return \Jaxon\Plugin\Response
397
+     * @return ResponseContract
398 398
      */
399 399
     public function clear($sTarget, $sAttribute)
400 400
     {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      * @param string        $sAttribute            The attribute to be updated
411 411
      * @param string        $sData                The value to assign
412 412
      *
413
-     * @return \Jaxon\Plugin\Response
413
+     * @return ResponseContract
414 414
      */
415 415
     public function contextAssign($sAttribute, $sData)
416 416
     {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
      * @param string        $sAttribute            The attribute to be appended to
433 433
      * @param string        $sData                The value to append
434 434
      *
435
-     * @return \Jaxon\Plugin\Response
435
+     * @return ResponseContract
436 436
      */
437 437
     public function contextAppend($sAttribute, $sData)
438 438
     {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      * @param string        $sAttribute            The attribute to be updated
455 455
      * @param string        $sData                The value to be prepended
456 456
      *
457
-     * @return \Jaxon\Plugin\Response
457
+     * @return ResponseContract
458 458
      */
459 459
     public function contextPrepend($sAttribute, $sData)
460 460
     {
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
      *
476 476
      * @param string        $sAttribute            The attribute to be cleared
477 477
      *
478
-     * @return \Jaxon\Plugin\Response
478
+     * @return ResponseContract
479 479
      */
480 480
     public function contextClear($sAttribute)
481 481
     {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      *
488 488
      * @param string        $sMessage            The message to be displayed
489 489
      *
490
-     * @return \Jaxon\Plugin\Response
490
+     * @return ResponseContract
491 491
      */
492 492
     public function alert($sMessage)
493 493
     {
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      *
505 505
      * @param string        $sMessage            The message to be displayed
506 506
      *
507
-     * @return \Jaxon\Plugin\Response
507
+     * @return ResponseContract
508 508
      */
509 509
     public function debug($sMessage)
510 510
     {
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
      * @param string        $sURL                The relative or fully qualified URL
523 523
      * @param integer        $iDelay                Number of seconds to delay before the redirect occurs
524 524
      *
525
-     * @return \Jaxon\Plugin\Response
525
+     * @return Response
526 526
      */
527 527
     public function redirect($sURL, $iDelay=0)
528 528
     {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
      *
576 576
      * @param string        $sJS                The script to execute
577 577
      *
578
-     * @return \Jaxon\Plugin\Response
578
+     * @return ResponseContract
579 579
      */
580 580
     public function script($sJS)
581 581
     {
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @param string        $sFunc                The name of the function to call
594 594
      *
595
-     * @return \Jaxon\Plugin\Response
595
+     * @return ResponseContract
596 596
      */
597 597
     public function call($sFunc)
598 598
     {
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
      *
613 613
      * @param string        $sTarget            The id of the element to be removed
614 614
      *
615
-     * @return \Jaxon\Plugin\Response
615
+     * @return ResponseContract
616 616
      */
617 617
     public function remove($sTarget)
618 618
     {
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      * @param string        $sTag                The tag name to be used for the new element
633 633
      * @param string        $sId                The id to assign to the new element
634 634
      *
635
-     * @return \Jaxon\Plugin\Response
635
+     * @return ResponseContract
636 636
      */
637 637
     public function create($sParent, $sTag, $sId)
638 638
     {
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
      * @param string        $sTag               The tag name to be used for the new element
654 654
      * @param string        $sId                The id to assign to the new element
655 655
      *
656
-     * @return \Jaxon\Plugin\Response
656
+     * @return ResponseContract
657 657
      */
658 658
     public function insert($sBefore, $sTag, $sId)
659 659
     {
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      * @param string        $sTag               The tag name to be used for the new element
675 675
      * @param string        $sId                The id to assign to the new element
676 676
      *
677
-     * @return \Jaxon\Plugin\Response
677
+     * @return ResponseContract
678 678
      */
679 679
     public function insertAfter($sAfter, $sTag, $sId)
680 680
     {
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
      * @param string        $sName                The name of the new input element
697 697
      * @param string        $sId                The id of the new element
698 698
      *
699
-     * @return \Jaxon\Plugin\Response
699
+     * @return ResponseContract
700 700
      */
701 701
     public function createInput($sParent, $sType, $sName, $sId)
702 702
     {
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
      * @param string        $sName                The name of the new input element
720 720
      * @param string        $sId                The id of the new element
721 721
      *
722
-     * @return \Jaxon\Plugin\Response
722
+     * @return ResponseContract
723 723
      */
724 724
     public function insertInput($sBefore, $sType, $sName, $sId)
725 725
     {
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
      * @param string        $sName                The name of the new input element
743 743
      * @param string        $sId                The id of the new element
744 744
      *
745
-     * @return \Jaxon\Plugin\Response
745
+     * @return ResponseContract
746 746
      */
747 747
     public function insertInputAfter($sAfter, $sType, $sName, $sId)
748 748
     {
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
      * @param string        $sEvent                The name of the event
765 765
      * @param string        $sScript            The javascript to execute when the event is fired
766 766
      *
767
-     * @return \Jaxon\Plugin\Response
767
+     * @return ResponseContract
768 768
      */
769 769
     public function setEvent($sTarget, $sEvent, $sScript)
770 770
     {
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
      * @param string        $sTarget            The id of the element that contains the event
785 785
      * @param string        $sScript            The javascript to execute when the event is fired
786 786
      *
787
-     * @return \Jaxon\Plugin\Response
787
+     * @return ResponseContract
788 788
      */
789 789
     public function onClick($sTarget, $sScript)
790 790
     {
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
      * @param string        $sEvent              The name of the event
801 801
      * @param string        $sHandler            The name of the javascript function to call when the event is fired
802 802
      *
803
-     * @return \Jaxon\Plugin\Response
803
+     * @return ResponseContract
804 804
      */
805 805
     public function addHandler($sTarget, $sEvent, $sHandler)
806 806
     {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
      * @param string        $sEvent              The name of the event
822 822
      * @param string        $sHandler            The name of the javascript function called when the event is fired
823 823
      *
824
-     * @return \Jaxon\Plugin\Response
824
+     * @return ResponseContract
825 825
      */
826 826
     public function removeHandler($sTarget, $sEvent, $sHandler)
827 827
     {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
      * @param string        $sArgs                Comma separated list of parameter names
843 843
      * @param string        $sScript            The javascript code that will become the body of the function
844 844
      *
845
-     * @return \Jaxon\Plugin\Response
845
+     * @return ResponseContract
846 846
      */
847 847
     public function setFunction($sFunction, $sArgs, $sScript)
848 848
     {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
      * @param string        $sReturnValueVar    The name of the variable that will retain the return value
870 870
      *                                             from the call to the original function
871 871
      *
872
-     * @return \Jaxon\Plugin\Response
872
+     * @return ResponseContract
873 873
      */
874 874
     public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar)
875 875
     {
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
891 891
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
892 892
      *
893
-     * @return \Jaxon\Plugin\Response
893
+     * @return ResponseContract
894 894
      */
895 895
     public function includeScript($sFileName, $sType = null, $sId = null)
896 896
     {
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
912 912
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
913 913
      *
914
-     * @return \Jaxon\Plugin\Response
914
+     * @return ResponseContract
915 915
      */
916 916
     public function includeScriptOnce($sFileName, $sType = null, $sId = null)
917 917
     {
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
935 935
      * @param string        $sUnload            Name of a javascript function to call prior to unlaoding the file
936 936
      *
937
-     * @return \Jaxon\Plugin\Response
937
+     * @return ResponseContract
938 938
      */
939 939
     public function removeScript($sFileName, $sUnload = '')
940 940
     {
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
      * @param string        $sFileName            The relative or fully qualified URI of the css file
956 956
      * @param string        $sMedia                The media type of the CSS file. Defaults to 'screen'
957 957
      *
958
-     * @return \Jaxon\Plugin\Response
958
+     * @return ResponseContract
959 959
      */
960 960
     public function includeCSS($sFileName, $sMedia = null)
961 961
     {
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
      *
975 975
      * @param string        $sFileName            The relative or fully qualified URI of the css file
976 976
      *
977
-     * @return \Jaxon\Plugin\Response
977
+     * @return ResponseContract
978 978
      */
979 979
     public function removeCSS($sFileName, $sMedia = null)
980 980
     {
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
      * @param integer        $iTimeout            The number of 1/10ths of a second to pause before timing out
1000 1000
      *                                             and continuing with the execution of the response commands
1001 1001
      *
1002
-     * @return \Jaxon\Plugin\Response
1002
+     * @return ResponseContract
1003 1003
      */
1004 1004
     public function waitForCSS($iTimeout = 600)
1005 1005
     {
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
      * @param integer        $tenths                The number of 1/10ths of a second to wait before timing out
1025 1025
      *                                             and continuing with the execution of the response commands.
1026 1026
      *
1027
-     * @return \Jaxon\Plugin\Response
1027
+     * @return ResponseContract
1028 1028
      */
1029 1029
     public function waitFor($script, $tenths)
1030 1030
     {
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
      *
1046 1046
      * @param integer        $tenths                The number of 1/10ths of a second to sleep
1047 1047
      *
1048
-     * @return \Jaxon\Plugin\Response
1048
+     * @return ResponseContract
1049 1049
      */
1050 1050
     public function sleep($tenths)
1051 1051
     {
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
      * @param string        $variable            The DOM element name (id or class)
1075 1075
      * @param string        $tag                The HTML tag of the new DOM element
1076 1076
      *
1077
-     * @return \Jaxon\Plugin\Response
1077
+     * @return ResponseContract
1078 1078
      */
1079 1079
     public function domCreateElement($variable, $tag)
1080 1080
     {
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
      * @param string        $key                The name of the attribute
1095 1095
      * @param string        $value                The value of the attribute
1096 1096
      *
1097
-     * @return \Jaxon\Plugin\Response
1097
+     * @return ResponseContract
1098 1098
      */
1099 1099
     public function domSetAttribute($variable, $key, $value)
1100 1100
     {
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
      * @param string        $skip                The ??
1116 1116
      * @param string        $remove                The ??
1117 1117
      *
1118
-     * @return \Jaxon\Plugin\Response
1118
+     * @return ResponseContract
1119 1119
      */
1120 1120
     public function domRemoveChildren($parent, $skip = null, $remove = null)
1121 1121
     {
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
      * @param string        $parent                The DOM parent element
1137 1137
      * @param string        $variable            The DOM element name (id or class)
1138 1138
      *
1139
-     * @return \Jaxon\Plugin\Response
1139
+     * @return ResponseContract
1140 1140
      */
1141 1141
     public function domAppendChild($parent, $variable)
1142 1142
     {
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
      * @param string        $target                The DOM target element
1156 1156
      * @param string        $variable            The DOM element name (id or class)
1157 1157
      *
1158
-     * @return \Jaxon\Plugin\Response
1158
+     * @return ResponseContract
1159 1159
      */
1160 1160
     public function domInsertBefore($target, $variable)
1161 1161
     {
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
      * @param string        $target                The DOM target element
1175 1175
      * @param string        $variable            The DOM element name (id or class)
1176 1176
      *
1177
-     * @return \Jaxon\Plugin\Response
1177
+     * @return ResponseContract
1178 1178
      */
1179 1179
     public function domInsertAfter($target, $variable)
1180 1180
     {
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
      * @param string        $parent                The DOM parent element
1194 1194
      * @param string        $text                The HTML text to append
1195 1195
      *
1196
-     * @return \Jaxon\Plugin\Response
1196
+     * @return ResponseContract
1197 1197
      */
1198 1198
     public function domAppendText($parent, $text)
1199 1199
     {
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
      *
1235 1235
      * @param mixed        $value                Any value
1236 1236
      *
1237
-     * @return \Jaxon\Plugin\Response
1237
+     * @return Response
1238 1238
      */
1239 1239
     public function setReturnValue($value)
1240 1240
     {
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function plugin($sName)
97 97
     {
98 98
         $xPlugin = $this->getPluginManager()->getResponsePlugin($sName);
99
-        if(!$xPlugin)
99
+        if (!$xPlugin)
100 100
         {
101 101
             return null;
102 102
         }
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
     public function addCommand($aAttributes, $mData)
160 160
     {
161 161
         /* merge commands if possible */
162
-        if(in_array($aAttributes['cmd'], ['js', 'ap']))
162
+        if (in_array($aAttributes['cmd'], ['js', 'ap']))
163 163
         {
164
-            if(($aLastCommand = array_pop($this->aCommands)))
164
+            if (($aLastCommand = array_pop($this->aCommands)))
165 165
             {
166
-                if($aLastCommand['cmd'] == $aAttributes['cmd'])
166
+                if ($aLastCommand['cmd'] == $aAttributes['cmd'])
167 167
                 {
168
-                    if($this->getOption('core.response.merge.js') &&
168
+                    if ($this->getOption('core.response.merge.js') &&
169 169
                             $aLastCommand['cmd'] == 'js')
170 170
                     {
171
-                        $mData = $aLastCommand['data'].'; '.$mData;
171
+                        $mData = $aLastCommand['data'] . '; ' . $mData;
172 172
                     }
173
-                    elseif($this->getOption('core.response.merge.ap') &&
173
+                    elseif ($this->getOption('core.response.merge.ap') &&
174 174
                             $aLastCommand['cmd'] == 'ap' &&
175 175
                             $aLastCommand['id'] == $aAttributes['id'] &&
176 176
                             $aLastCommand['prop'] == $aAttributes['prop'])
177 177
                     {
178
-                        $mData = $aLastCommand['data'].' '.$mData;
178
+                        $mData = $aLastCommand['data'] . ' ' . $mData;
179 179
                     }
180 180
                     else
181 181
                     {
@@ -233,26 +233,26 @@  discard block
 block discarded – undo
233 233
     public function appendResponse(ResponseContract $mCommands, $bBefore = false)
234 234
     {
235 235
         $aCommands = [];
236
-        if($mCommands instanceof Response)
236
+        if ($mCommands instanceof Response)
237 237
         {
238 238
             $this->returnValue = $mCommands->returnValue;
239 239
             $aCommands = $mCommands->aCommands;
240 240
         }
241
-        elseif(is_array($mCommands))
241
+        elseif (is_array($mCommands))
242 242
         {
243 243
             $aCommands = $mCommands;
244 244
         }
245 245
         else
246 246
         {
247
-            if(!empty($mCommands))
247
+            if (!empty($mCommands))
248 248
             {
249 249
                 throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid'));
250 250
             }
251 251
         }
252 252
 
253
-        if(count($aCommands) > 0)
253
+        if (count($aCommands) > 0)
254 254
         {
255
-            if($bBefore)
255
+            if ($bBefore)
256 256
             {
257 257
                 $this->aCommands = array_merge($aCommands, $this->aCommands);
258 258
             }
@@ -524,33 +524,33 @@  discard block
 block discarded – undo
524 524
      *
525 525
      * @return \Jaxon\Plugin\Response
526 526
      */
527
-    public function redirect($sURL, $iDelay=0)
527
+    public function redirect($sURL, $iDelay = 0)
528 528
     {
529 529
         // we need to parse the query part so that the values are rawurlencode()'ed
530 530
         // can't just use parse_url() cos we could be dealing with a relative URL which
531 531
         // parse_url() can't deal with.
532 532
         $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
533
-        if($queryStart !== false)
533
+        if ($queryStart !== false)
534 534
         {
535 535
             $queryStart++;
536 536
             $queryEnd = strpos($sURL, '#', $queryStart);
537
-            if($queryEnd === false)
537
+            if ($queryEnd === false)
538 538
                 $queryEnd = strlen($sURL);
539
-            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
539
+            $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
540 540
             parse_str($queryPart, $queryParts);
541 541
             $newQueryPart = "";
542
-            if($queryParts)
542
+            if ($queryParts)
543 543
             {
544 544
                 $first = true;
545
-                foreach($queryParts as $key => $value)
545
+                foreach ($queryParts as $key => $value)
546 546
                 {
547
-                    if($first)
547
+                    if ($first)
548 548
                         $first = false;
549 549
                     else
550 550
                         $newQueryPart .= '&';
551
-                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
551
+                    $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value);
552 552
                 }
553
-            } elseif($_SERVER['QUERY_STRING']) {
553
+            } elseif ($_SERVER['QUERY_STRING']) {
554 554
                     //couldn't break up the query, but there's one there
555 555
                     //possibly "http://url/page.html?query1234" type of query?
556 556
                     //just encode it and hope it works
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
                 }
559 559
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
560 560
         }
561
-        if($iDelay)
562
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
561
+        if ($iDelay)
562
+            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');');
563 563
         else
564 564
             $this->script('window.location = "' . $sURL . '";');
565 565
         return $this;
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
     {
897 897
         $command = ['cmd'  =>  'in'];
898 898
 
899
-        if(($sType))
899
+        if (($sType))
900 900
             $command['type'] = trim((string)$sType, " \t");
901 901
 
902
-        if(($sId))
902
+        if (($sId))
903 903
             $command['elm_id'] = trim((string)$sId, " \t");
904 904
 
905 905
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -917,10 +917,10 @@  discard block
 block discarded – undo
917 917
     {
918 918
         $command = ['cmd' => 'ino'];
919 919
 
920
-        if(($sType))
920
+        if (($sType))
921 921
             $command['type'] = trim((string)$sType, " \t");
922 922
 
923
-        if(($sId))
923
+        if (($sId))
924 924
             $command['elm_id'] = trim((string)$sId, " \t");
925 925
 
926 926
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
     {
962 962
         $command = ['cmd' => 'css'];
963 963
 
964
-        if(($sMedia))
964
+        if (($sMedia))
965 965
             $command['media'] = trim((string)$sMedia, " \t");
966 966
 
967 967
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
     {
981 981
         $command = ['cmd' => 'rcss'];
982 982
 
983
-        if(($sMedia))
983
+        if (($sMedia))
984 984
             $command['media'] = trim((string)$sMedia, " \t");
985 985
 
986 986
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -1121,10 +1121,10 @@  discard block
 block discarded – undo
1121 1121
     {
1122 1122
         $command = ['cmd' => 'DRC'];
1123 1123
 
1124
-        if(($skip))
1124
+        if (($skip))
1125 1125
             $command['skip'] = $skip;
1126 1126
 
1127
-        if(($remove))
1127
+        if (($remove))
1128 1128
             $command['remove'] = $remove;
1129 1129
 
1130 1130
         return $this->addCommand($command, $parent);
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
      */
1250 1250
     public function sendHeaders()
1251 1251
     {
1252
-        if($this->getRequesthandler()->requestMethodIsGet())
1252
+        if ($this->getRequesthandler()->requestMethodIsGet())
1253 1253
         {
1254 1254
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1255 1255
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
         $sCharacterSet = '';
1261 1261
         $sCharacterEncoding = trim($this->getOption('core.encoding'));
1262
-        if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1262
+        if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1263 1263
         {
1264 1264
             $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
1265 1265
         }
@@ -1276,13 +1276,13 @@  discard block
 block discarded – undo
1276 1276
     {
1277 1277
         $response = [];
1278 1278
 
1279
-        if(($this->returnValue))
1279
+        if (($this->returnValue))
1280 1280
         {
1281 1281
             $response['jxnrv'] = $this->returnValue;
1282 1282
         }
1283 1283
         $response['jxnobj'] = [];
1284 1284
 
1285
-        foreach($this->aCommands as $xCommand)
1285
+        foreach ($this->aCommands as $xCommand)
1286 1286
         {
1287 1287
             $response['jxnobj'][] = $xCommand;
1288 1288
         }
Please login to merge, or discard this patch.
src/Response/Manager.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function append(ResponseContract $xResponse)
88 88
     {
89
-        if(!$this->xResponse)
89
+        if (!$this->xResponse)
90 90
         {
91 91
             $this->xResponse = $xResponse;
92 92
         }
93
-        elseif(get_class($this->xResponse) == get_class($xResponse))
93
+        elseif (get_class($this->xResponse) == get_class($xResponse))
94 94
         {
95
-            if($this->xResponse != $xResponse)
95
+            if ($this->xResponse != $xResponse)
96 96
             {
97 97
                 $this->xResponse->appendResponse($xResponse);
98 98
             }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function printDebug()
141 141
     {
142
-        if(($this->xResponse))
142
+        if (($this->xResponse))
143 143
         {
144
-            foreach($this->aDebugMessages as $sMessage)
144
+            foreach ($this->aDebugMessages as $sMessage)
145 145
             {
146 146
                 $this->xResponse->debug($sMessage);
147 147
             }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function sendHeaders()
158 158
     {
159
-        if(($this->xResponse))
159
+        if (($this->xResponse))
160 160
         {
161 161
             $this->xResponse->sendHeaders();
162 162
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function getOutput()
171 171
     {
172
-        if(($this->xResponse))
172
+        if (($this->xResponse))
173 173
         {
174 174
             return $this->xResponse->getOutput();
175 175
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function sendOutput()
185 185
     {
186
-        if(($this->xResponse))
186
+        if (($this->xResponse))
187 187
         {
188 188
             $this->xResponse->sendHeaders();
189 189
             $this->xResponse->printOutput();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,15 +89,13 @@
 block discarded – undo
89 89
         if(!$this->xResponse)
90 90
         {
91 91
             $this->xResponse = $xResponse;
92
-        }
93
-        elseif(get_class($this->xResponse) == get_class($xResponse))
92
+        } elseif(get_class($this->xResponse) == get_class($xResponse))
94 93
         {
95 94
             if($this->xResponse != $xResponse)
96 95
             {
97 96
                 $this->xResponse->appendResponse($xResponse);
98 97
             }
99
-        }
100
-        else
98
+        } else
101 99
         {
102 100
             $this->debug($this->trans('errors.mismatch.types', ['class' => get_class($xResponse)]));
103 101
         }
Please login to merge, or discard this patch.
src/Plugin/CodeGenerator.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     private function getJsLibExt()
103 103
     {
104
-        if(($this->getOption('js.app.minify')))
104
+        if (($this->getOption('js.app.minify')))
105 105
         {
106 106
             return '.min.js';
107 107
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         // Check config options
119 119
         // - The js.app.export option must be set to true
120 120
         // - The js.app.uri and js.app.dir options must be set to non null values
121
-        if(!$this->getOption('js.app.export') ||
121
+        if (!$this->getOption('js.app.export') ||
122 122
             !$this->getOption('js.app.uri') ||
123 123
             !$this->getOption('js.app.dir'))
124 124
         {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         // Check dir access
128 128
         // - The js.app.dir must be writable
129 129
         $sJsAppDir = $this->getOption('js.app.dir');
130
-        if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
130
+        if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
131 131
         {
132 132
             return false;
133 133
         }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
     private function generateHash()
143 143
     {
144 144
         $sHash = jaxon()->getVersion();
145
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
145
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
146 146
         {
147 147
             $sHash .= $xPlugin->generateHash();
148 148
         }
149
-        foreach($this->xPluginManager->getResponsePlugins() as $xPlugin)
149
+        foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin)
150 150
         {
151 151
             $sHash .= $xPlugin->generateHash();
152 152
         }
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
      */
161 161
     private function makePluginsCode()
162 162
     {
163
-        if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
163
+        if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
164 164
         {
165 165
             $this->sCssCode = '';
166 166
             $this->sJsCode = '';
167 167
             $this->sJsReady = '';
168
-            foreach($this->xPluginManager->getResponsePlugins() as $xResponsePlugin)
168
+            foreach ($this->xPluginManager->getResponsePlugins() as $xResponsePlugin)
169 169
             {
170
-                if(($sCssCode = trim($xResponsePlugin->getCss())))
170
+                if (($sCssCode = trim($xResponsePlugin->getCss())))
171 171
                 {
172 172
                     $this->sCssCode .= rtrim($sCssCode, " \n") . "\n";
173 173
                 }
174
-                if(($sJsCode = trim($xResponsePlugin->getJs())))
174
+                if (($sJsCode = trim($xResponsePlugin->getJs())))
175 175
                 {
176 176
                     $this->sJsCode .= rtrim($sJsCode, " \n") . "\n";
177 177
                 }
178
-                if(($sJsReady = trim($xResponsePlugin->getScript())))
178
+                if (($sJsReady = trim($xResponsePlugin->getScript())))
179 179
                 {
180 180
                     $this->sJsReady .= trim($sJsReady, " \n") . "\n";
181 181
                 }
@@ -184,26 +184,26 @@  discard block
 block discarded – undo
184 184
             $this->sJsReady = $this->xTemplate->render('jaxon::plugins/ready.js', [
185 185
                 'sPluginScript' => $this->sJsReady,
186 186
             ]);
187
-            foreach($this->xPluginManager->getRequestPlugins() as $xRequestPlugin)
187
+            foreach ($this->xPluginManager->getRequestPlugins() as $xRequestPlugin)
188 188
             {
189
-                if(($sJsReady = trim($xRequestPlugin->getScript())))
189
+                if (($sJsReady = trim($xRequestPlugin->getScript())))
190 190
                 {
191 191
                     $this->sJsReady .= trim($sJsReady, " \n") . "\n";
192 192
                 }
193 193
             }
194 194
 
195
-            foreach($this->xPluginManager->getPackages() as $sPackageClass)
195
+            foreach ($this->xPluginManager->getPackages() as $sPackageClass)
196 196
             {
197 197
                 $xPackage = jaxon()->di()->get($sPackageClass);
198
-                if(($sCssCode = trim($xPackage->css())))
198
+                if (($sCssCode = trim($xPackage->css())))
199 199
                 {
200 200
                     $this->sCssCode .= rtrim($sCssCode, " \n") . "\n";
201 201
                 }
202
-                if(($sJsCode = trim($xPackage->js())))
202
+                if (($sJsCode = trim($xPackage->js())))
203 203
                 {
204 204
                     $this->sJsCode .= rtrim($sJsCode, " \n") . "\n";
205 205
                 }
206
-                if(($sJsReady = trim($xPackage->ready())))
206
+                if (($sJsReady = trim($xPackage->ready())))
207 207
                 {
208 208
                     $this->sJsReady .= trim($sJsReady, " \n") . "\n";
209 209
                 }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // Add component files to the javascript file array;
229 229
         $aJsFiles = [$sJsCoreUrl];
230
-        if($this->getOption('core.debug.on'))
230
+        if ($this->getOption('core.debug.on'))
231 231
         {
232 232
             $aJsFiles[] = $sJsDebugUrl;
233 233
             $aJsFiles[] = $sJsLanguageUrl;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      */
322 322
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
323 323
     {
324
-        if(!$this->getOption('core.request.uri'))
324
+        if (!$this->getOption('core.request.uri'))
325 325
         {
326 326
             $this->setOption('core.request.uri', URI::detect());
327 327
         }
@@ -330,16 +330,16 @@  discard block
 block discarded – undo
330 330
         $this->makePluginsCode();
331 331
 
332 332
         $sScript = '';
333
-        if(($bIncludeCss))
333
+        if (($bIncludeCss))
334 334
         {
335 335
             $sScript .= $this->getCss() . "\n";
336 336
         }
337
-        if(($bIncludeJs))
337
+        if (($bIncludeJs))
338 338
         {
339 339
             $sScript .= $this->getJs() . "\n";
340 340
         }
341 341
 
342
-        if($this->canExportJavascript())
342
+        if ($this->canExportJavascript())
343 343
         {
344 344
             $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/';
345 345
             $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/';
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $sExtension = $this->getJsLibExt();
348 348
 
349 349
             // Check if the final file already exists
350
-            if(($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension))
350
+            if (($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension))
351 351
             {
352 352
                 $sOutFile = $sFinalFile . $sExtension;
353 353
             }
@@ -357,25 +357,25 @@  discard block
 block discarded – undo
357 357
                 $sHash = $this->generateHash();
358 358
                 $sOutFile = $sHash . '.js';
359 359
                 $sMinFile = $sHash . '.min.js';
360
-                if(!is_file($sJsAppDir . $sOutFile))
360
+                if (!is_file($sJsAppDir . $sOutFile))
361 361
                 {
362 362
                     file_put_contents($sJsAppDir . $sOutFile, $this->_getScript());
363 363
                 }
364
-                if(($this->getOption('js.app.minify')))
364
+                if (($this->getOption('js.app.minify')))
365 365
                 {
366
-                    if(is_file($sJsAppDir . $sMinFile))
366
+                    if (is_file($sJsAppDir . $sMinFile))
367 367
                     {
368 368
                         $sOutFile = $sMinFile; // The file was already minified
369 369
                     }
370
-                    elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
370
+                    elseif (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
371 371
                     {
372 372
                         $sOutFile = $sMinFile;
373 373
                     }
374 374
                 }
375 375
                 // Copy the file to its final location
376
-                if(($sFinalFile))
376
+                if (($sFinalFile))
377 377
                 {
378
-                    if(copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension))
378
+                    if (copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension))
379 379
                     {
380 380
                         $sOutFile = $sFinalFile . $sExtension;
381 381
                     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -350,8 +350,7 @@  discard block
 block discarded – undo
350 350
             if(($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension))
351 351
             {
352 352
                 $sOutFile = $sFinalFile . $sExtension;
353
-            }
354
-            else
353
+            } else
355 354
             {
356 355
                 // The plugins scripts are written into the javascript app dir
357 356
                 $sHash = $this->generateHash();
@@ -366,8 +365,7 @@  discard block
 block discarded – undo
366 365
                     if(is_file($sJsAppDir . $sMinFile))
367 366
                     {
368 367
                         $sOutFile = $sMinFile; // The file was already minified
369
-                    }
370
-                    elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
368
+                    } elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
371 369
                     {
372 370
                         $sOutFile = $sMinFile;
373 371
                     }
@@ -387,8 +385,7 @@  discard block
 block discarded – undo
387 385
                 'sJsOptions' => $this->getOption('js.app.options', ''),
388 386
                 'sUrl' => $sJsAppURI . $sOutFile,
389 387
             ]);
390
-        }
391
-        else
388
+        } else
392 389
         {
393 390
             // The plugins scripts are wrapped with javascript tags
394 391
             $sScript .= $this->xTemplate->render('jaxon::plugins/wrapper.js', [
Please login to merge, or discard this patch.
src/Plugin/Manager.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -138,33 +138,33 @@  discard block
 block discarded – undo
138 138
         $bIsAlert = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Alert);
139 139
         $bIsConfirm = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Confirm);
140 140
         $bIsListener = ($xPlugin instanceof \Jaxon\Contracts\Event\Listener);
141
-        if($xPlugin instanceof Request)
141
+        if ($xPlugin instanceof Request)
142 142
         {
143 143
             // The name of a request plugin is used as key in the plugin table
144 144
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
145 145
         }
146
-        elseif($xPlugin instanceof Response)
146
+        elseif ($xPlugin instanceof Response)
147 147
         {
148 148
             // The name of a response plugin is used as key in the plugin table
149 149
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
150 150
         }
151
-        elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener)
151
+        elseif (!$bIsConfirm && !$bIsAlert && !$bIsListener)
152 152
         {
153 153
             $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]);
154 154
             throw new \Jaxon\Exception\Error($sErrorMessage);
155 155
         }
156 156
         // This plugin implements the Alert interface
157
-        if($bIsAlert)
157
+        if ($bIsAlert)
158 158
         {
159 159
             jaxon()->dialog()->setAlert($xPlugin);
160 160
         }
161 161
         // This plugin implements the Confirm interface
162
-        if($bIsConfirm)
162
+        if ($bIsConfirm)
163 163
         {
164 164
             jaxon()->dialog()->setConfirm($xPlugin);
165 165
         }
166 166
         // Register the plugin as an event listener
167
-        if($bIsListener)
167
+        if ($bIsListener)
168 168
         {
169 169
             $this->addEventListener($xPlugin);
170 170
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function registerCallable($sType, $sCallable, $aOptions = [])
201 201
     {
202
-        if(!key_exists($sType, $this->aRequestPlugins))
202
+        if (!key_exists($sType, $this->aRequestPlugins))
203 203
         {
204 204
             throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType]));
205 205
         }
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
     private function registerCallablesFromConfig($xAppConfig, $sSection, $sCallableType)
221 221
     {
222 222
         $aConfig = $xAppConfig->getOption($sSection, []);
223
-        foreach($aConfig as $xKey => $xValue)
223
+        foreach ($aConfig 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->registerCallable($sCallableType, $xValue);
229 229
             }
230
-            elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
230
+            elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue)))
231 231
             {
232 232
                 // Register a function with options
233 233
                 $this->registerCallable($sCallableType, $xKey, $xValue);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      */
270 270
     public function getResponsePlugin($sName)
271 271
     {
272
-        if(array_key_exists($sName, $this->aResponsePlugins))
272
+        if (array_key_exists($sName, $this->aResponsePlugins))
273 273
         {
274 274
             return $this->aResponsePlugins[$sName];
275 275
         }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function getRequestPlugin($sName)
287 287
     {
288
-        if(array_key_exists($sName, $this->aRequestPlugins))
288
+        if (array_key_exists($sName, $this->aRequestPlugins))
289 289
         {
290 290
             return $this->aRequestPlugins[$sName];
291 291
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -142,13 +142,11 @@  discard block
 block discarded – undo
142 142
         {
143 143
             // The name of a request plugin is used as key in the plugin table
144 144
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
145
-        }
146
-        elseif($xPlugin instanceof Response)
145
+        } elseif($xPlugin instanceof Response)
147 146
         {
148 147
             // The name of a response plugin is used as key in the plugin table
149 148
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
150
-        }
151
-        elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener)
149
+        } elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener)
152 150
         {
153 151
             $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]);
154 152
             throw new \Jaxon\Exception\Error($sErrorMessage);
@@ -226,13 +224,11 @@  discard block
 block discarded – undo
226 224
             {
227 225
                 // Register a function without options
228 226
                 $this->registerCallable($sCallableType, $xValue);
229
-            }
230
-            elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
227
+            } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
231 228
             {
232 229
                 // Register a function with options
233 230
                 $this->registerCallable($sCallableType, $xKey, $xValue);
234
-            }
235
-            else
231
+            } else
236 232
             {
237 233
                 continue;
238 234
                 // Todo: throw an exception
Please login to merge, or discard this patch.
src/App/Bootstrap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $this->triggerEvent('pre.setup');
155 155
 
156 156
         // Add the view renderer
157
-        $view->addRenderer('jaxon', function () {
157
+        $view->addRenderer('jaxon', function() {
158 158
             return new View\View();
159 159
         });
160 160
 
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
         // Use the Composer autoloader. It's important to call this before triggers and callbacks.
182 182
         // $jaxon->useComposerAutoloader();
183 183
         // Jaxon library settings
184
-        if(!$jaxon->hasOption('js.app.export'))
184
+        if (!$jaxon->hasOption('js.app.export'))
185 185
         {
186 186
             $jaxon->setOption('js.app.export', $this->bExportJs);
187 187
         }
188
-        if(!$jaxon->hasOption('js.app.minify'))
188
+        if (!$jaxon->hasOption('js.app.minify'))
189 189
         {
190 190
             $jaxon->setOption('js.app.minify', $this->bMinifyJs);
191 191
         }
192
-        if(!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '')
192
+        if (!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '')
193 193
         {
194 194
             $jaxon->setOption('js.app.uri', $this->sJsUri);
195 195
         }
196
-        if(!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '')
196
+        if (!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '')
197 197
         {
198 198
             $jaxon->setOption('js.app.dir', $this->sJsDir);
199 199
         }
200 200
         // Set the request URI
201
-        if(!$jaxon->hasOption('core.request.uri') && $this->sUri != '')
201
+        if (!$jaxon->hasOption('core.request.uri') && $this->sUri != '')
202 202
         {
203 203
             $jaxon->setOption('core.request.uri', $this->sUri);
204 204
         }
Please login to merge, or discard this patch.
src/CallableClass.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
         return jaxon()->instance($name);
95 95
     }
96 96
 
97
-   /**
97
+    /**
98 98
      * Get the uploaded files
99 99
      *
100 100
      * @return array
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,12 +81,12 @@
 block discarded – undo
81 81
         $xCallableObject = jaxon()->di()->getCallableRepository()->getCallableObject(get_class($this));
82 82
         $cFirstChar = substr($name, 0, 1);
83 83
         // If the class name starts with a dot, then find the class in the same full namespace as the caller
84
-        if($cFirstChar == ':')
84
+        if ($cFirstChar == ':')
85 85
         {
86 86
             $name = $xCallableObject->getRootNamespace() . '\\' . str_replace('.', '\\', substr($name, 1));
87 87
         }
88 88
         // If the class name starts with a dot, then find the class in the same base namespace as the caller
89
-        elseif($cFirstChar == '.')
89
+        elseif ($cFirstChar == '.')
90 90
         {
91 91
             $name = $xCallableObject->getNamespace() . '\\' . str_replace('.', '\\', substr($name, 1));
92 92
         }
Please login to merge, or discard this patch.