Completed
Push — master ( f09443...3ab6e3 )
by Thierry
15s queued 10s
created
src/Request/Manager.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
         $this->aArgs = array();
56 56
         $this->nMethod = Jaxon::METHOD_UNKNOWN;
57 57
         
58
-        if(isset($_POST['jxnargs']))
58
+        if (isset($_POST['jxnargs']))
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62 62
         }
63
-        elseif(isset($_GET['jxnargs']))
63
+        elseif (isset($_GET['jxnargs']))
64 64
         {
65 65
             $this->nMethod = Jaxon::METHOD_GET;
66 66
             $this->aArgs = $_GET['jxnargs'];
67 67
         }
68
-        if(get_magic_quotes_gpc() == 1)
68
+        if (get_magic_quotes_gpc() == 1)
69 69
         {
70 70
             array_walk($this->aArgs, array(&$this, '__argumentStripSlashes'));
71 71
         }
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private function __convertStringToBool($sValue)
83 83
     {
84
-        if(strcasecmp($sValue, 'true') == 0)
84
+        if (strcasecmp($sValue, 'true') == 0)
85 85
         {
86 86
             return true;
87 87
         }
88
-        if(strcasecmp($sValue, 'false') == 0)
88
+        if (strcasecmp($sValue, 'false') == 0)
89 89
         {
90 90
             return false;
91 91
         }
92
-        if(is_numeric($sValue))
92
+        if (is_numeric($sValue))
93 93
         {
94
-            if($sValue == 0)
94
+            if ($sValue == 0)
95 95
             {
96 96
                 return false;
97 97
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function __argumentStripSlashes(&$sArg)
111 111
     {
112
-        if(!is_string($sArg))
112
+        if (!is_string($sArg))
113 113
         {
114 114
             return '';
115 115
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     private function __argumentDecode(&$sArg)
159 159
     {
160
-        if($sArg == '')
160
+        if ($sArg == '')
161 161
         {
162 162
             return '';
163 163
         }
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
         $sType = 'multipart/form-data';
167 167
         $iLen = strlen($sType);
168 168
         $sContentType = '';
169
-        if(key_exists('CONTENT_TYPE', $_SERVER))
169
+        if (key_exists('CONTENT_TYPE', $_SERVER))
170 170
         {
171 171
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
172 172
         }
173
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
173
+        elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER))
174 174
         {
175 175
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
176 176
         }
177
-        if($sContentType == $sType)
177
+        if ($sContentType == $sType)
178 178
         {
179 179
             $sArg = urldecode($sArg);
180 180
         }
181 181
 
182 182
         $data = json_decode($sArg, true);
183 183
 
184
-        if($data !== null && $sArg != $data)
184
+        if ($data !== null && $sArg != $data)
185 185
         {
186 186
             $sArg = $data;
187 187
         }
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
      */
201 201
     private function __argumentDecodeUTF8_iconv(&$mArg)
202 202
     {
203
-        if(is_array($mArg))
203
+        if (is_array($mArg))
204 204
         {
205
-            foreach($mArg as $sKey => &$xArg)
205
+            foreach ($mArg as $sKey => &$xArg)
206 206
             {
207 207
                 $sNewKey = $sKey;
208 208
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
209
-                if($sNewKey != $sKey)
209
+                if ($sNewKey != $sKey)
210 210
                 {
211 211
                     $mArg[$sNewKey] = $xArg;
212 212
                     unset($mArg[$sKey]);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 $this->__argumentDecodeUTF8_iconv($xArg);
216 216
             }
217 217
         }
218
-        elseif(is_string($mArg))
218
+        elseif (is_string($mArg))
219 219
         {
220 220
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
221 221
         }
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
      */
231 231
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
232 232
     {
233
-        if(is_array($mArg))
233
+        if (is_array($mArg))
234 234
         {
235
-            foreach($mArg as $sKey => &$xArg)
235
+            foreach ($mArg as $sKey => &$xArg)
236 236
             {
237 237
                 $sNewKey = $sKey;
238 238
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
239
-                if($sNewKey != $sKey)
239
+                if ($sNewKey != $sKey)
240 240
                 {
241 241
                     $mArg[$sNewKey] = $xArg;
242 242
                     unset($mArg[$sKey]);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
246 246
             }
247 247
         }
248
-        elseif(is_string($mArg))
248
+        elseif (is_string($mArg))
249 249
         {
250 250
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
251 251
         }
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
      */
261 261
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
262 262
     {
263
-        if(is_array($mArg))
263
+        if (is_array($mArg))
264 264
         {
265
-            foreach($mArg as $sKey => &$xArg)
265
+            foreach ($mArg as $sKey => &$xArg)
266 266
             {
267 267
                 $sNewKey = $sKey;
268 268
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
269 269
                 
270
-                if($sNewKey != $sKey)
270
+                if ($sNewKey != $sKey)
271 271
                 {
272 272
                     $mArg[$sNewKey] = $xArg;
273 273
                     unset($mArg[$sKey]);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
278 278
             }
279 279
         }
280
-        elseif(is_string($mArg))
280
+        elseif (is_string($mArg))
281 281
         {
282 282
             $mArg = utf8_decode($mArg);
283 283
         }
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function process()
304 304
     {
305
-        if(($this->getOption('core.decode_utf8')))
305
+        if (($this->getOption('core.decode_utf8')))
306 306
         {
307 307
             $sFunction = '';
308 308
             
309
-            if(function_exists('iconv'))
309
+            if (function_exists('iconv'))
310 310
             {
311 311
                 $sFunction = "iconv";
312 312
             }
313
-            elseif(function_exists('mb_convert_encoding'))
313
+            elseif (function_exists('mb_convert_encoding'))
314 314
             {
315 315
                 $sFunction = "mb_convert_encoding";
316 316
             }
317
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
317
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
318 318
             {
319 319
                 $sFunction = "utf8_decode";
320 320
             }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62
-        }
63
-        elseif(isset($_GET['jxnargs']))
62
+        } elseif(isset($_GET['jxnargs']))
64 63
         {
65 64
             $this->nMethod = Jaxon::METHOD_GET;
66 65
             $this->aArgs = $_GET['jxnargs'];
@@ -169,8 +168,7 @@  discard block
 block discarded – undo
169 168
         if(key_exists('CONTENT_TYPE', $_SERVER))
170 169
         {
171 170
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
172
-        }
173
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
171
+        } elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
174 172
         {
175 173
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
176 174
         }
@@ -184,8 +182,7 @@  discard block
 block discarded – undo
184 182
         if($data !== null && $sArg != $data)
185 183
         {
186 184
             $sArg = $data;
187
-        }
188
-        else
185
+        } else
189 186
         {
190 187
             $sArg = $this->__convertValue($sArg);
191 188
         }
@@ -214,8 +211,7 @@  discard block
 block discarded – undo
214 211
                 }
215 212
                 $this->__argumentDecodeUTF8_iconv($xArg);
216 213
             }
217
-        }
218
-        elseif(is_string($mArg))
214
+        } elseif(is_string($mArg))
219 215
         {
220 216
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
221 217
         }
@@ -244,8 +240,7 @@  discard block
 block discarded – undo
244 240
                 }
245 241
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
246 242
             }
247
-        }
248
-        elseif(is_string($mArg))
243
+        } elseif(is_string($mArg))
249 244
         {
250 245
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
251 246
         }
@@ -276,8 +271,7 @@  discard block
 block discarded – undo
276 271
                 
277 272
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
278 273
             }
279
-        }
280
-        elseif(is_string($mArg))
274
+        } elseif(is_string($mArg))
281 275
         {
282 276
             $mArg = utf8_decode($mArg);
283 277
         }
@@ -309,16 +303,13 @@  discard block
 block discarded – undo
309 303
             if(function_exists('iconv'))
310 304
             {
311 305
                 $sFunction = "iconv";
312
-            }
313
-            elseif(function_exists('mb_convert_encoding'))
306
+            } elseif(function_exists('mb_convert_encoding'))
314 307
             {
315 308
                 $sFunction = "mb_convert_encoding";
316
-            }
317
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
309
+            } elseif($this->getOption('core.encoding') == "ISO-8859-1")
318 310
             {
319 311
                 $sFunction = "utf8_decode";
320
-            }
321
-            else
312
+            } else
322 313
             {
323 314
                 throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion'));
324 315
             }
Please login to merge, or discard this patch.