Completed
Push — master ( f42a52...0a9499 )
by Thierry
02:50 queued 01:16
created
src/Utils/View/Renderer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     protected function store()
42 42
     {
43
-        if(!$this->xStore)
43
+        if (!$this->xStore)
44 44
         {
45 45
             $this->xStore = new Store();
46 46
         }
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         $sNamespace = $this->xManager->getDefaultNamespace();
94 94
         // Get the namespace from the view name
95 95
         $iSeparatorPosition = strrpos($sViewName, '::');
96
-        if($iSeparatorPosition !== false)
96
+        if ($iSeparatorPosition !== false)
97 97
         {
98 98
             $sNamespace = substr($sViewName, 0, $iSeparatorPosition);
99 99
         }
100 100
         $aRenderers = $this->xManager->getRenderers();
101
-        if(!key_exists($sNamespace, $aRenderers))
101
+        if (!key_exists($sNamespace, $aRenderers))
102 102
         {
103 103
             // Cannot render a view if there's no renderer corresponding to the namespace.
104 104
             return null;
Please login to merge, or discard this patch.
src/Utils/View/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
         $sViewName = $store->getViewName();
49 49
         $sNamespace = $store->getNamespace();
50 50
         // In this view renderer, the namespace must always be prepended to the view name.
51
-        if(substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
51
+        if (substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
52 52
         {
53 53
             $sViewName = $sNamespace . '::' . $sViewName;
54 54
         }
Please login to merge, or discard this patch.
src/Utils/Http/URI.php 1 patch
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.
src/Response/Response.php 2 patches
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($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.
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.
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/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.
src/Request/Factory/Parameter.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function make($xValue)
107 107
     {
108
-        if($xValue instanceof Contracts\Parameter)
108
+        if ($xValue instanceof Contracts\Parameter)
109 109
         {
110 110
             return $xValue;
111 111
         }
112
-        elseif(is_numeric($xValue))
112
+        elseif (is_numeric($xValue))
113 113
         {
114 114
             return new Parameter(self::NUMERIC_VALUE, $xValue);
115 115
         }
116
-        elseif(is_string($xValue))
116
+        elseif (is_string($xValue))
117 117
         {
118 118
             return new Parameter(self::QUOTED_VALUE, $xValue);
119 119
         }
120
-        elseif(is_bool($xValue))
120
+        elseif (is_bool($xValue))
121 121
         {
122 122
             return new Parameter(self::BOOL_VALUE, $xValue);
123 123
         }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function getScript()
162 162
     {
163 163
         $sJsCode = '';
164
-        switch($this->sType)
164
+        switch ($this->sType)
165 165
         {
166 166
         case self::FORM_VALUES:
167 167
             $sJsCode = $this->getJsCall('getFormValues', $this->xValue);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $sJsCode = (string)$this->xValue;
189 189
             break;
190 190
         case self::JS_VALUE:
191
-            if(is_array($this->xValue) || is_object($this->xValue))
191
+            if (is_array($this->xValue) || is_object($this->xValue))
192 192
             {
193 193
                 // Unable to use double quotes here because they cannot be handled on client side.
194 194
                 // So we are using simple quotes even if the Json standard recommends double quotes.
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -108,20 +108,16 @@  discard block
 block discarded – undo
108 108
         if($xValue instanceof Contracts\Parameter)
109 109
         {
110 110
             return $xValue;
111
-        }
112
-        elseif(is_numeric($xValue))
111
+        } elseif(is_numeric($xValue))
113 112
         {
114 113
             return new Parameter(self::NUMERIC_VALUE, $xValue);
115
-        }
116
-        elseif(is_string($xValue))
114
+        } elseif(is_string($xValue))
117 115
         {
118 116
             return new Parameter(self::QUOTED_VALUE, $xValue);
119
-        }
120
-        elseif(is_bool($xValue))
117
+        } elseif(is_bool($xValue))
121 118
         {
122 119
             return new Parameter(self::BOOL_VALUE, $xValue);
123
-        }
124
-        else // if(is_array($xValue) || is_object($xValue))
120
+        } else // if(is_array($xValue) || is_object($xValue))
125 121
         {
126 122
             return new Parameter(self::JS_VALUE, $xValue);
127 123
         }
@@ -193,8 +189,7 @@  discard block
 block discarded – undo
193 189
                 // Unable to use double quotes here because they cannot be handled on client side.
194 190
                 // So we are using simple quotes even if the Json standard recommends double quotes.
195 191
                 $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT));
196
-            }
197
-            else
192
+            } else
198 193
             {
199 194
                 $sJsCode = (string)$this->xValue;
200 195
             }
Please login to merge, or discard this patch.
src/Request/Factory/JsCall.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,9 +154,9 @@
 block discarded – undo
154 154
      */
155 155
     public function addParameters(array $aParameters)
156 156
     {
157
-        foreach($aParameters as $xParameter)
157
+        foreach ($aParameters as $xParameter)
158 158
         {
159
-            if($xParameter instanceof JsCall)
159
+            if ($xParameter instanceof JsCall)
160 160
             {
161 161
                 $this->addParameter(Parameter::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
162 162
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -159,8 +159,7 @@
 block discarded – undo
159 159
             if($xParameter instanceof JsCall)
160 160
             {
161 161
                 $this->addParameter(Parameter::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
162
-            }
163
-            else
162
+            } else
164 163
             {
165 164
                 $this->pushParameter(Parameter::make($xParameter));
166 165
             }
Please login to merge, or discard this patch.