Completed
Push — master ( cae0c7...3123e6 )
by Thierry
24s
created
src/Response/Response.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function plugin($sName)
102 102
     {
103 103
         $xPlugin = $this->getPluginManager()->getResponsePlugin($sName);
104
-        if(!$xPlugin)
104
+        if (!$xPlugin)
105 105
         {
106 106
             return null;
107 107
         }
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
     public function addCommand($aAttributes, $mData)
165 165
     {
166 166
         /* merge commands if possible */
167
-        if(in_array($aAttributes['cmd'], array('js', 'ap')))
167
+        if (in_array($aAttributes['cmd'], array('js', 'ap')))
168 168
         {
169
-            if(($aLastCommand = array_pop($this->aCommands)))
169
+            if (($aLastCommand = array_pop($this->aCommands)))
170 170
             {
171
-                if($aLastCommand['cmd'] == $aAttributes['cmd'])
171
+                if ($aLastCommand['cmd'] == $aAttributes['cmd'])
172 172
                 {
173
-                    if($this->getOption('core.response.merge.js') &&
173
+                    if ($this->getOption('core.response.merge.js') &&
174 174
                             $aLastCommand['cmd'] == 'js')
175 175
                     {
176
-                        $mData = $aLastCommand['data'].'; '.$mData;
176
+                        $mData = $aLastCommand['data'] . '; ' . $mData;
177 177
                     }
178
-                    elseif($this->getOption('core.response.merge.ap') &&
178
+                    elseif ($this->getOption('core.response.merge.ap') &&
179 179
                             $aLastCommand['cmd'] == 'ap' &&
180 180
                             $aLastCommand['id'] == $aAttributes['id'] &&
181 181
                             $aLastCommand['prop'] == $aAttributes['prop'])
182 182
                     {
183
-                        $mData = $aLastCommand['data'].' '.$mData;
183
+                        $mData = $aLastCommand['data'] . ' ' . $mData;
184 184
                     }
185 185
                     else
186 186
                     {
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function appendResponse($mCommands, $bBefore = false)
239 239
     {
240
-        if($mCommands instanceof Response)
240
+        if ($mCommands instanceof Response)
241 241
         {
242 242
             $this->returnValue = $mCommands->returnValue;
243 243
             
244
-            if($bBefore)
244
+            if ($bBefore)
245 245
             {
246 246
                 $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands);
247 247
             }
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                 $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands);
251 251
             }
252 252
         }
253
-        elseif(is_array($mCommands))
253
+        elseif (is_array($mCommands))
254 254
         {
255
-            if($bBefore)
255
+            if ($bBefore)
256 256
             {
257 257
                 $this->aCommands = array_merge($mCommands, $this->aCommands);
258 258
             }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         }
264 264
         else
265 265
         {
266
-            if(!empty($mCommands))
266
+            if (!empty($mCommands))
267 267
             {
268 268
                 throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid'));
269 269
             }
@@ -531,33 +531,33 @@  discard block
 block discarded – undo
531 531
      *
532 532
      * @return \Jaxon\Plugin\Response
533 533
      */
534
-    public function redirect($sURL, $iDelay=0)
534
+    public function redirect($sURL, $iDelay = 0)
535 535
     {
536 536
         // we need to parse the query part so that the values are rawurlencode()'ed
537 537
         // can't just use parse_url() cos we could be dealing with a relative URL which
538 538
         // parse_url() can't deal with.
539 539
         $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
540
-        if($queryStart !== false)
540
+        if ($queryStart !== false)
541 541
         {
542 542
             $queryStart++;
543 543
             $queryEnd = strpos($sURL, '#', $queryStart);
544
-            if($queryEnd === false)
544
+            if ($queryEnd === false)
545 545
                 $queryEnd = strlen($sURL);
546
-            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
546
+            $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
547 547
             parse_str($queryPart, $queryParts);
548 548
             $newQueryPart = "";
549
-            if($queryParts)
549
+            if ($queryParts)
550 550
             {
551 551
                 $first = true;
552
-                foreach($queryParts as $key => $value)
552
+                foreach ($queryParts as $key => $value)
553 553
                 {
554
-                    if($first)
554
+                    if ($first)
555 555
                         $first = false;
556 556
                     else
557 557
                         $newQueryPart .= '&';
558
-                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
558
+                    $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value);
559 559
                 }
560
-            } elseif($_SERVER['QUERY_STRING']) {
560
+            } elseif ($_SERVER['QUERY_STRING']) {
561 561
                     //couldn't break up the query, but there's one there
562 562
                     //possibly "http://url/page.html?query1234" type of query?
563 563
                     //just encode it and hope it works
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
                 }
566 566
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
567 567
         }
568
-        if($iDelay)
569
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
568
+        if ($iDelay)
569
+            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');');
570 570
         else
571 571
             $this->script('window.location = "' . $sURL . '";');
572 572
         return $this;
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
     {
904 904
         $command = array('cmd'  =>  'in');
905 905
         
906
-        if(($sType))
906
+        if (($sType))
907 907
             $command['type'] = trim((string)$sType, " \t");
908 908
         
909
-        if(($sId))
909
+        if (($sId))
910 910
             $command['elm_id'] = trim((string)$sId, " \t");
911 911
 
912 912
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
     {
925 925
         $command = array('cmd' => 'ino');
926 926
         
927
-        if(($sType))
927
+        if (($sType))
928 928
             $command['type'] = trim((string)$sType, " \t");
929 929
         
930
-        if(($sId))
930
+        if (($sId))
931 931
             $command['elm_id'] = trim((string)$sId, " \t");
932 932
             
933 933
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
     {
969 969
         $command = array('cmd' => 'css');
970 970
         
971
-        if(($sMedia))
971
+        if (($sMedia))
972 972
             $command['media'] = trim((string)$sMedia, " \t");
973 973
         
974 974
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     {
988 988
         $command = array('cmd' => 'rcss');
989 989
         
990
-        if(($sMedia))
990
+        if (($sMedia))
991 991
             $command['media'] = trim((string)$sMedia, " \t");
992 992
         
993 993
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
     {
1129 1129
         $command = array('cmd' => 'DRC');
1130 1130
 
1131
-        if(($skip))
1131
+        if (($skip))
1132 1132
             $command['skip'] = $skip;
1133 1133
 
1134
-        if(($remove))
1134
+        if (($remove))
1135 1135
             $command['remove'] = $remove;
1136 1136
 
1137 1137
         return $this->addCommand($command, $parent);
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
     public function sendHeaders()
1258 1258
     {
1259 1259
         $xRequestManager = $this->getRequestManager();
1260
-        if($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET)
1260
+        if ($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET)
1261 1261
         {
1262 1262
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1263 1263
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
         
1268 1268
         $sCharacterSet = '';
1269 1269
         $sCharacterEncoding = trim($this->getOption('core.encoding'));
1270
-        if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1270
+        if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1271 1271
         {
1272 1272
             $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
1273 1273
         }
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
     {
1285 1285
         $response = array();
1286 1286
         
1287
-        if(($this->returnValue))
1287
+        if (($this->returnValue))
1288 1288
         {
1289 1289
             $response['jxnrv'] = $this->returnValue;
1290 1290
         }
1291 1291
         $response['jxnobj'] = array();
1292 1292
 
1293
-        foreach($this->aCommands as $xCommand)
1293
+        foreach ($this->aCommands as $xCommand)
1294 1294
         {
1295 1295
             $response['jxnobj'][] = $xCommand;
1296 1296
         }
Please login to merge, or discard this patch.
Braces   +44 added lines, -40 removed lines patch added patch discarded remove patch
@@ -174,20 +174,17 @@  discard block
 block discarded – undo
174 174
                             $aLastCommand['cmd'] == 'js')
175 175
                     {
176 176
                         $mData = $aLastCommand['data'].'; '.$mData;
177
-                    }
178
-                    elseif($this->getOption('core.response.merge.ap') &&
177
+                    } elseif($this->getOption('core.response.merge.ap') &&
179 178
                             $aLastCommand['cmd'] == 'ap' &&
180 179
                             $aLastCommand['id'] == $aAttributes['id'] &&
181 180
                             $aLastCommand['prop'] == $aAttributes['prop'])
182 181
                     {
183 182
                         $mData = $aLastCommand['data'].' '.$mData;
184
-                    }
185
-                    else
183
+                    } else
186 184
                     {
187 185
                         $this->aCommands[] = $aLastCommand;
188 186
                     }
189
-                }
190
-                else
187
+                } else
191 188
                 {
192 189
                     $this->aCommands[] = $aLastCommand;
193 190
                 }
@@ -244,24 +241,20 @@  discard block
 block discarded – undo
244 241
             if($bBefore)
245 242
             {
246 243
                 $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands);
247
-            }
248
-            else
244
+            } else
249 245
             {
250 246
                 $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands);
251 247
             }
252
-        }
253
-        elseif(is_array($mCommands))
248
+        } elseif(is_array($mCommands))
254 249
         {
255 250
             if($bBefore)
256 251
             {
257 252
                 $this->aCommands = array_merge($mCommands, $this->aCommands);
258
-            }
259
-            else
253
+            } else
260 254
             {
261 255
                 $this->aCommands = array_merge($this->aCommands, $mCommands);
262 256
             }
263
-        }
264
-        else
257
+        } else
265 258
         {
266 259
             if(!empty($mCommands))
267 260
             {
@@ -541,8 +534,9 @@  discard block
 block discarded – undo
541 534
         {
542 535
             $queryStart++;
543 536
             $queryEnd = strpos($sURL, '#', $queryStart);
544
-            if($queryEnd === false)
545
-                $queryEnd = strlen($sURL);
537
+            if($queryEnd === false) {
538
+                            $queryEnd = strlen($sURL);
539
+            }
546 540
             $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
547 541
             parse_str($queryPart, $queryParts);
548 542
             $newQueryPart = "";
@@ -551,10 +545,11 @@  discard block
 block discarded – undo
551 545
                 $first = true;
552 546
                 foreach($queryParts as $key => $value)
553 547
                 {
554
-                    if($first)
555
-                        $first = false;
556
-                    else
557
-                        $newQueryPart .= '&';
548
+                    if($first) {
549
+                                            $first = false;
550
+                    } else {
551
+                                            $newQueryPart .= '&';
552
+                    }
558 553
                     $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
559 554
                 }
560 555
             } elseif($_SERVER['QUERY_STRING']) {
@@ -565,10 +560,11 @@  discard block
 block discarded – undo
565 560
                 }
566 561
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
567 562
         }
568
-        if($iDelay)
569
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
570
-        else
571
-            $this->script('window.location = "' . $sURL . '";');
563
+        if($iDelay) {
564
+                    $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
565
+        } else {
566
+                    $this->script('window.location = "' . $sURL . '";');
567
+        }
572 568
         return $this;
573 569
     }
574 570
 
@@ -903,11 +899,13 @@  discard block
 block discarded – undo
903 899
     {
904 900
         $command = array('cmd'  =>  'in');
905 901
         
906
-        if(($sType))
907
-            $command['type'] = trim((string)$sType, " \t");
902
+        if(($sType)) {
903
+                    $command['type'] = trim((string)$sType, " \t");
904
+        }
908 905
         
909
-        if(($sId))
910
-            $command['elm_id'] = trim((string)$sId, " \t");
906
+        if(($sId)) {
907
+                    $command['elm_id'] = trim((string)$sId, " \t");
908
+        }
911 909
 
912 910
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
913 911
     }
@@ -924,11 +922,13 @@  discard block
 block discarded – undo
924 922
     {
925 923
         $command = array('cmd' => 'ino');
926 924
         
927
-        if(($sType))
928
-            $command['type'] = trim((string)$sType, " \t");
925
+        if(($sType)) {
926
+                    $command['type'] = trim((string)$sType, " \t");
927
+        }
929 928
         
930
-        if(($sId))
931
-            $command['elm_id'] = trim((string)$sId, " \t");
929
+        if(($sId)) {
930
+                    $command['elm_id'] = trim((string)$sId, " \t");
931
+        }
932 932
             
933 933
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
934 934
     }
@@ -968,8 +968,9 @@  discard block
 block discarded – undo
968 968
     {
969 969
         $command = array('cmd' => 'css');
970 970
         
971
-        if(($sMedia))
972
-            $command['media'] = trim((string)$sMedia, " \t");
971
+        if(($sMedia)) {
972
+                    $command['media'] = trim((string)$sMedia, " \t");
973
+        }
973 974
         
974 975
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
975 976
     }
@@ -987,8 +988,9 @@  discard block
 block discarded – undo
987 988
     {
988 989
         $command = array('cmd' => 'rcss');
989 990
         
990
-        if(($sMedia))
991
-            $command['media'] = trim((string)$sMedia, " \t");
991
+        if(($sMedia)) {
992
+                    $command['media'] = trim((string)$sMedia, " \t");
993
+        }
992 994
         
993 995
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
994 996
     }
@@ -1128,11 +1130,13 @@  discard block
 block discarded – undo
1128 1130
     {
1129 1131
         $command = array('cmd' => 'DRC');
1130 1132
 
1131
-        if(($skip))
1132
-            $command['skip'] = $skip;
1133
+        if(($skip)) {
1134
+                    $command['skip'] = $skip;
1135
+        }
1133 1136
 
1134
-        if(($remove))
1135
-            $command['remove'] = $remove;
1137
+        if(($remove)) {
1138
+                    $command['remove'] = $remove;
1139
+        }
1136 1140
 
1137 1141
         return $this->addCommand($command, $parent);
1138 1142
     }
Please login to merge, or discard this patch.
src/Traits/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             'core.prefix.event'                 => 'jaxon_event_',
44 44
             // 'core.request.uri'               => '',
45 45
             'core.request.mode'                 => 'asynchronous',
46
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
46
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
47 47
             'core.response.merge.ap'            => true,
48 48
             'core.response.merge.js'            => true,
49 49
             'core.debug.on'                     => false,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
119 119
     {
120 120
         $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
121
-        switch($sExt)
121
+        switch ($sExt)
122 122
         {
123 123
         case 'php':
124 124
             return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey);
Please login to merge, or discard this patch.