Completed
Push — master ( 5d7b0f...8d92ea )
by Thierry
03:20
created
src/Config/Config.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
         $sPrefix = trim((string)$sPrefix);
46 46
         $nDepth = intval($nDepth);
47 47
         // Check the max depth
48
-        if($nDepth < 0 || $nDepth > 9)
48
+        if ($nDepth < 0 || $nDepth > 9)
49 49
         {
50 50
             throw new \Jaxon\Config\Exception\Data(jaxon_trans('config.errors.data.depth',
51 51
                 array('key' => $sPrefix, 'depth' => $nDepth)));
52 52
         }
53
-        foreach($aOptions as $sName => $xOption)
53
+        foreach ($aOptions as $sName => $xOption)
54 54
         {
55
-            if(is_int($sName))
55
+            if (is_int($sName))
56 56
             {
57 57
                 continue;
58 58
             }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             // Save the value of this option
63 63
             $this->aOptions[$sFullName] = $xOption;
64 64
             // Save the values of its sub-options
65
-            if(is_array($xOption))
65
+            if (is_array($xOption))
66 66
             {
67 67
                 // Recursively read the options in the array
68 68
                 $this->_setOptions($xOption, $sFullName, $nDepth + 1);
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         $aKeys = explode('.', (string)$sKeys);
85 85
         foreach ($aKeys as $sKey)
86 86
         {
87
-            if(($sKey))
87
+            if (($sKey))
88 88
             {
89
-                if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey]))
89
+                if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey]))
90 90
                 {
91 91
                     return;
92 92
                 }
@@ -134,13 +134,12 @@  discard block
 block discarded – undo
134 134
         $sPrefix = rtrim($sPrefix, '.') . '.';
135 135
         $sPrefixLen = strlen($sPrefix);
136 136
         $aOptions = [];
137
-        foreach($this->aOptions as $sName => $xValue)
137
+        foreach ($this->aOptions as $sName => $xValue)
138 138
         {
139
-            if(substr($sName, 0, $sPrefixLen) == $sPrefix)
139
+            if (substr($sName, 0, $sPrefixLen) == $sPrefix)
140 140
             {
141 141
                 $iNextDotPos = strpos($sName, '.', $sPrefixLen);
142
-                $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) :
143
-                    substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen);
142
+                $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen);
144 143
                 $aOptions[$sOptionName] = $sPrefix . $sOptionName;
145 144
             }
146 145
         }
Please login to merge, or discard this patch.
src/Config/Yaml.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
     public static function read($sConfigFile)
27 27
     {
28 28
         $sConfigFile = realpath($sConfigFile);
29
-        if(!extension_loaded('yaml'))
29
+        if (!extension_loaded('yaml'))
30 30
         {
31 31
             throw new \Jaxon\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install'));
32 32
         }
33
-        if(!is_readable($sConfigFile))
33
+        if (!is_readable($sConfigFile))
34 34
         {
35 35
             throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile)));
36 36
         }
37 37
         $aConfigOptions = yaml_parse_file($sConfigFile);
38
-        if(!is_array($aConfigOptions))
38
+        if (!is_array($aConfigOptions))
39 39
         {
40 40
             throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile)));
41 41
         }
Please login to merge, or discard this patch.
src/Config/Reader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     public function read($sConfigFile)
25 25
     {
26 26
         $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
27
-        switch($sExt)
27
+        switch ($sExt)
28 28
         {
29 29
         case 'php':
30 30
             $aConfigOptions = Php::read($sConfigFile);
Please login to merge, or discard this patch.
src/Config/Json.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
     public static function read($sConfigFile)
27 27
     {
28 28
         $sConfigFile = realpath($sConfigFile);
29
-        if(!is_readable($sConfigFile))
29
+        if (!is_readable($sConfigFile))
30 30
         {
31 31
             throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile)));
32 32
         }
33 33
         $sFileContent = file_get_contents($sConfigFile);
34 34
         $aConfigOptions = json_decode($sFileContent, true);
35
-        if(!is_array($aConfigOptions))
35
+        if (!is_array($aConfigOptions))
36 36
         {
37 37
             throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile)));
38 38
         }
Please login to merge, or discard this patch.
src/Request/Handler.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
      *
153 153
      * @param string        $sArg                The Jaxon request argument
154 154
      *
155
-     * @return mixed
155
+     * @return string|null
156 156
      */
157 157
     private function __argumentDecode(&$sArg)
158 158
     {
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -131,19 +131,19 @@
 block discarded – undo
131 131
         $sValue = substr($sValue, 1);
132 132
         switch ($cType)
133 133
         {
134
-            case 'S':
135
-                $value = ($sValue === false ? '' : $sValue);
136
-                break;
137
-            case 'B':
138
-                $value = $this->__convertStringToBool($sValue);
139
-                break;
140
-            case 'N':
141
-                $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
-                break;
143
-            case '*':
144
-            default:
145
-                $value = null;
146
-                break;
134
+        case 'S':
135
+            $value = ($sValue === false ? '' : $sValue);
136
+            break;
137
+        case 'B':
138
+            $value = $this->__convertStringToBool($sValue);
139
+            break;
140
+        case 'N':
141
+            $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
+            break;
143
+        case '*':
144
+        default:
145
+            $value = null;
146
+            break;
147 147
         }
148 148
         return $value;
149 149
     }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
         $this->aArgs = [];
64 64
         $this->nMethod = Jaxon::METHOD_UNKNOWN;
65 65
 
66
-        if(isset($_POST['jxnargs']))
66
+        if (isset($_POST['jxnargs']))
67 67
         {
68 68
             $this->nMethod = Jaxon::METHOD_POST;
69 69
             $this->aArgs = $_POST['jxnargs'];
70 70
         }
71
-        elseif(isset($_GET['jxnargs']))
71
+        elseif (isset($_GET['jxnargs']))
72 72
         {
73 73
             $this->nMethod = Jaxon::METHOD_GET;
74 74
             $this->aArgs = $_GET['jxnargs'];
75 75
         }
76
-        if(get_magic_quotes_gpc() == 1)
76
+        if (get_magic_quotes_gpc() == 1)
77 77
         {
78 78
             array_walk($this->aArgs, array(&$this, '__argumentStripSlashes'));
79 79
         }
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
      */
90 90
     private function __convertStringToBool($sValue)
91 91
     {
92
-        if(strcasecmp($sValue, 'true') == 0)
92
+        if (strcasecmp($sValue, 'true') == 0)
93 93
         {
94 94
             return true;
95 95
         }
96
-        if(strcasecmp($sValue, 'false') == 0)
96
+        if (strcasecmp($sValue, 'false') == 0)
97 97
         {
98 98
             return false;
99 99
         }
100
-        if(is_numeric($sValue))
100
+        if (is_numeric($sValue))
101 101
         {
102
-            if($sValue == 0)
102
+            if ($sValue == 0)
103 103
             {
104 104
                 return false;
105 105
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     private function __argumentStripSlashes(&$sArg)
119 119
     {
120
-        if(!is_string($sArg))
120
+        if (!is_string($sArg))
121 121
         {
122 122
             return '';
123 123
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function __argumentDecode(&$sArg)
167 167
     {
168
-        if($sArg == '')
168
+        if ($sArg == '')
169 169
         {
170 170
             return '';
171 171
         }
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
         $sType = 'multipart/form-data';
175 175
         $iLen = strlen($sType);
176 176
         $sContentType = '';
177
-        if(key_exists('CONTENT_TYPE', $_SERVER))
177
+        if (key_exists('CONTENT_TYPE', $_SERVER))
178 178
         {
179 179
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
180 180
         }
181
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
181
+        elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER))
182 182
         {
183 183
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
184 184
         }
185
-        if($sContentType == $sType)
185
+        if ($sContentType == $sType)
186 186
         {
187 187
             $sArg = urldecode($sArg);
188 188
         }
189 189
 
190 190
         $data = json_decode($sArg, true);
191 191
 
192
-        if($data !== null && $sArg != $data)
192
+        if ($data !== null && $sArg != $data)
193 193
         {
194 194
             $sArg = $data;
195 195
         }
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
      */
209 209
     private function __argumentDecodeUTF8_iconv(&$mArg)
210 210
     {
211
-        if(is_array($mArg))
211
+        if (is_array($mArg))
212 212
         {
213
-            foreach($mArg as $sKey => &$xArg)
213
+            foreach ($mArg as $sKey => &$xArg)
214 214
             {
215 215
                 $sNewKey = $sKey;
216 216
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
217
-                if($sNewKey != $sKey)
217
+                if ($sNewKey != $sKey)
218 218
                 {
219 219
                     $mArg[$sNewKey] = $xArg;
220 220
                     unset($mArg[$sKey]);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                 $this->__argumentDecodeUTF8_iconv($xArg);
224 224
             }
225 225
         }
226
-        elseif(is_string($mArg))
226
+        elseif (is_string($mArg))
227 227
         {
228 228
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
229 229
         }
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
      */
239 239
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
240 240
     {
241
-        if(is_array($mArg))
241
+        if (is_array($mArg))
242 242
         {
243
-            foreach($mArg as $sKey => &$xArg)
243
+            foreach ($mArg as $sKey => &$xArg)
244 244
             {
245 245
                 $sNewKey = $sKey;
246 246
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
247
-                if($sNewKey != $sKey)
247
+                if ($sNewKey != $sKey)
248 248
                 {
249 249
                     $mArg[$sNewKey] = $xArg;
250 250
                     unset($mArg[$sKey]);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
254 254
             }
255 255
         }
256
-        elseif(is_string($mArg))
256
+        elseif (is_string($mArg))
257 257
         {
258 258
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
259 259
         }
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
      */
269 269
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
270 270
     {
271
-        if(is_array($mArg))
271
+        if (is_array($mArg))
272 272
         {
273
-            foreach($mArg as $sKey => &$xArg)
273
+            foreach ($mArg as $sKey => &$xArg)
274 274
             {
275 275
                 $sNewKey = $sKey;
276 276
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
277 277
 
278
-                if($sNewKey != $sKey)
278
+                if ($sNewKey != $sKey)
279 279
                 {
280 280
                     $mArg[$sNewKey] = $xArg;
281 281
                     unset($mArg[$sKey]);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
286 286
             }
287 287
         }
288
-        elseif(is_string($mArg))
288
+        elseif (is_string($mArg))
289 289
         {
290 290
             $mArg = utf8_decode($mArg);
291 291
         }
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
      */
311 311
     public function processArguments()
312 312
     {
313
-        if(($this->getOption('core.decode_utf8')))
313
+        if (($this->getOption('core.decode_utf8')))
314 314
         {
315 315
             $sFunction = '';
316 316
 
317
-            if(function_exists('iconv'))
317
+            if (function_exists('iconv'))
318 318
             {
319 319
                 $sFunction = "iconv";
320 320
             }
321
-            elseif(function_exists('mb_convert_encoding'))
321
+            elseif (function_exists('mb_convert_encoding'))
322 322
             {
323 323
                 $sFunction = "mb_convert_encoding";
324 324
             }
325
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
325
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
326 326
             {
327 327
                 $sFunction = "utf8_decode";
328 328
             }
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function canProcessRequest()
351 351
     {
352
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
352
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
353 353
         {
354
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
354
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
355 355
             {
356 356
                 return true;
357 357
             }
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
      */
370 370
     public function processRequest()
371 371
     {
372
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
372
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
373 373
         {
374
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
374
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
375 375
             {
376 376
                 $xUploadPlugin = $this->xPluginManager->getRequestPlugin(Jaxon::FILE_UPLOAD);
377 377
                 // Process uploaded files
378
-                if($xUploadPlugin != null)
378
+                if ($xUploadPlugin != null)
379 379
                 {
380 380
                     $xUploadPlugin->processRequest();
381 381
                 }
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.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 namespace Jaxon\Request;
24 24
 
25 25
 use Jaxon\Jaxon;
26
-
27 26
 use Jaxon\Plugin\Manager as PluginManager;
28 27
 
29 28
 class Handler
Please login to merge, or discard this patch.
src/Jaxon.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             'core.prefix.class'                 => 'Jaxon',
157 157
             // 'core.request.uri'               => '',
158 158
             'core.request.mode'                 => 'asynchronous',
159
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
159
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
160 160
             'core.response.merge.ap'            => true,
161 161
             'core.response.merge.js'            => true,
162 162
             'core.debug.on'                     => false,
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
246 246
     {
247
-        if(!$this->getOption('core.request.uri'))
247
+        if (!$this->getOption('core.request.uri'))
248 248
         {
249 249
             $this->setOption('core.request.uri', URI::detect());
250 250
         }
251 251
         $sCode = '';
252 252
         $xCodeGenerator = $this->di()->getCodeGenerator();
253
-        if(($bIncludeCss))
253
+        if (($bIncludeCss))
254 254
         {
255 255
             $sCode .= $xCodeGenerator->getCss() . "\n";
256 256
         }
257
-        if(($bIncludeJs))
257
+        if (($bIncludeJs))
258 258
         {
259 259
             $sCode .= $xCodeGenerator->getJs() . "\n";
260 260
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     public function processRequest()
326 326
     {
327 327
         // Check to see if headers have already been sent out, in which case we can't do our job
328
-        if(headers_sent($filename, $linenumber))
328
+        if (headers_sent($filename, $linenumber))
329 329
         {
330 330
             echo $this->trans('errors.output.already-sent', array(
331 331
                 'location' => $filename . ':' . $linenumber
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         }
335 335
 
336 336
         // Check if there is a plugin to process this request
337
-        if(!$this->canProcessRequest())
337
+        if (!$this->canProcessRequest())
338 338
         {
339 339
             return;
340 340
         }
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
         $xResponseManager = $this->getResponseManager();
345 345
 
346 346
         // Handle before processing event
347
-        if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
347
+        if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
348 348
         {
349 349
             $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest));
350 350
         }
351 351
 
352
-        if(!$bEndRequest)
352
+        if (!$bEndRequest)
353 353
         {
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357 357
             }
358
-            catch(Exception $e)
358
+            catch (Exception $e)
359 359
             {
360 360
                 // An exception was thrown while processing the request.
361 361
                 // The request missed the corresponding handler function,
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 $xResponseManager->debug($e->getMessage());
368 368
                 $mResult = false;
369 369
 
370
-                if($e instanceof \Jaxon\Exception\Error)
370
+                if ($e instanceof \Jaxon\Exception\Error)
371 371
                 {
372 372
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 373
                     $aParams = array($e->getMessage());
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
                     $aParams = array($e);
379 379
                 }
380 380
 
381
-                if(isset($this->aProcessingEvents[$sEvent]))
381
+                if (isset($this->aProcessingEvents[$sEvent]))
382 382
                 {
383 383
                     // Call the processing event
384 384
                     $this->aProcessingEvents[$sEvent]->call($aParams);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             }
392 392
         }
393 393
         // Clean the processing buffer
394
-        if(($this->getOption('core.process.clean')))
394
+        if (($this->getOption('core.process.clean')))
395 395
         {
396 396
             $er = error_reporting(0);
397 397
             while (ob_get_level() > 0)
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
             error_reporting($er);
402 402
         }
403 403
 
404
-        if($mResult === true)
404
+        if ($mResult === true)
405 405
         {
406 406
             // Handle after processing event
407
-            if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
407
+            if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
408 408
             {
409 409
                 $bEndRequest = false;
410 410
                 $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest));
411 411
             }
412 412
             // If the called function returned no response, give the the global response instead
413
-            if($xResponseManager->hasNoResponse())
413
+            if ($xResponseManager->hasNoResponse())
414 414
             {
415 415
                 $xResponseManager->append($this->getResponse());
416 416
             }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
         $xResponseManager->printDebug();
420 420
 
421
-        if(($this->getOption('core.process.exit')))
421
+        if (($this->getOption('core.process.exit')))
422 422
         {
423 423
             $xResponseManager->sendOutput();
424 424
             exit();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -354,8 +354,7 @@  discard block
 block discarded – undo
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357
-            }
358
-            catch(Exception $e)
357
+            } catch(Exception $e)
359 358
             {
360 359
                 // An exception was thrown while processing the request.
361 360
                 // The request missed the corresponding handler function,
@@ -371,8 +370,7 @@  discard block
 block discarded – undo
371 370
                 {
372 371
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 372
                     $aParams = array($e->getMessage());
374
-                }
375
-                else
373
+                } else
376 374
                 {
377 375
                     $sEvent = self::PROCESSING_EVENT_ERROR;
378 376
                     $aParams = array($e);
@@ -382,8 +380,7 @@  discard block
 block discarded – undo
382 380
                 {
383 381
                     // Call the processing event
384 382
                     $this->aProcessingEvents[$sEvent]->call($aParams);
385
-                }
386
-                else
383
+                } else
387 384
                 {
388 385
                     // The exception is not to be processed here.
389 386
                     throw $e;
Please login to merge, or discard this patch.
src/Dialog/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/Code/Generator.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private function getJsLibUri()
77 77
     {
78
-        if(!$this->hasOption('js.lib.uri'))
78
+        if (!$this->hasOption('js.lib.uri'))
79 79
         {
80 80
             // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/';
81 81
             return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/';
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         // The jsDelivr CDN only hosts minified files
99 99
         // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri)
100 100
         // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files.
101
-        if(($this->getOption('js.app.minify')))
101
+        if (($this->getOption('js.app.minify')))
102 102
         {
103 103
             return '.min.js';
104 104
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         // Check config options
116 116
         // - The js.app.extern option must be set to true
117 117
         // - The js.app.uri and js.app.dir options must be set to non null values
118
-        if(!$this->getOption('js.app.extern') ||
118
+        if (!$this->getOption('js.app.extern') ||
119 119
             !$this->getOption('js.app.uri') ||
120 120
             !$this->getOption('js.app.dir'))
121 121
         {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         // Check dir access
125 125
         // - The js.app.dir must be writable
126 126
         $sJsAppDir = $this->getOption('js.app.dir');
127
-        if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
127
+        if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
128 128
         {
129 129
             return false;
130 130
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     private function setTemplateCacheDir()
140 140
     {
141
-        if($this->hasOption('core.template.cache_dir'))
141
+        if ($this->hasOption('core.template.cache_dir'))
142 142
         {
143 143
             $this->setCacheDir($this->getOption('core.template.cache_dir'));
144 144
         }
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
     private function generateHash()
153 153
     {
154 154
         $sHash = jaxon()->getVersion();
155
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
155
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
156 156
         {
157 157
             $sHash .= $xPlugin->generateHash();
158 158
         }
159
-        foreach($this->xPluginManager->getResponsePlugins() as $xPlugin)
159
+        foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin)
160 160
         {
161 161
             $sHash .= $xPlugin->generateHash();
162 162
         }
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
      */
171 171
     private function makePluginsCode()
172 172
     {
173
-        if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
173
+        if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
174 174
         {
175 175
             $this->sCssCode = '';
176 176
             $this->sJsCode = '';
177 177
             $this->sJsReady = '';
178
-            foreach($this->xPluginManager->getResponsePlugins() as $xPlugin)
178
+            foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin)
179 179
             {
180
-                if(($str = trim($xPlugin->getCss())))
180
+                if (($str = trim($xPlugin->getCss())))
181 181
                 {
182 182
                     $this->sCssCode .= rtrim($str, " \n") . "\n";
183 183
                 }
184
-                if(($str = trim($xPlugin->getJs())))
184
+                if (($str = trim($xPlugin->getJs())))
185 185
                 {
186 186
                     $this->sJsCode .= rtrim($str, " \n") . "\n";
187 187
                 }
188
-                if(($str = trim($xPlugin->getScript())))
188
+                if (($str = trim($xPlugin->getScript())))
189 189
                 {
190 190
                     $this->sJsReady .= "\n" . trim($str, " \n");
191 191
                 }
192 192
             }
193 193
 
194 194
             $this->sJsReady = $this->render('jaxon::plugins/ready.js', ['sPluginScript' => $this->sJsReady]);
195
-            foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
195
+            foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
196 196
             {
197
-                if(($str = trim($xPlugin->getScript())))
197
+                if (($str = trim($xPlugin->getScript())))
198 198
                 {
199 199
                     $this->sJsReady .= "\n" . trim($str, " \n");
200 200
                 }
201 201
             }
202 202
 
203
-            foreach($this->xPluginManager->getPackages() as $sClass)
203
+            foreach ($this->xPluginManager->getPackages() as $sClass)
204 204
             {
205 205
                 $xPackage = jaxon()->di()->get($sClass);
206
-                if(($str = trim($xPackage->css())))
206
+                if (($str = trim($xPackage->css())))
207 207
                 {
208 208
                     $this->sCssCode .= rtrim($str, " \n") . "\n";
209 209
                 }
210
-                if(($str = trim($xPackage->js())))
210
+                if (($str = trim($xPackage->js())))
211 211
                 {
212 212
                     $this->sJsCode .= rtrim($str, " \n") . "\n";
213 213
                 }
214 214
                 $xPackage = jaxon()->di()->get($sClass);
215
-                if(($str = trim($xPackage->ready())))
215
+                if (($str = trim($xPackage->ready())))
216 216
                 {
217 217
                     $this->sJsReady .= "\n" . trim($str, " \n");
218 218
                 }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
         // Add component files to the javascript file array;
238 238
         $aJsFiles = array($sJsCoreUrl);
239
-        if($this->getOption('core.debug.on'))
239
+        if ($this->getOption('core.debug.on'))
240 240
         {
241 241
             $aJsFiles[] = $sJsDebugUrl;
242 242
             $aJsFiles[] = $sJsLanguageUrl;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $this->setTemplateCacheDir();
332 332
         $this->makePluginsCode();
333 333
 
334
-        if($this->canExportJavascript())
334
+        if ($this->canExportJavascript())
335 335
         {
336 336
             $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/';
337 337
             $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/';
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
             $sHash = $this->generateHash();
341 341
             $sOutFile = $sHash . '.js';
342 342
             $sMinFile = $sHash . '.min.js';
343
-            if(!is_file($sJsAppDir . $sOutFile))
343
+            if (!is_file($sJsAppDir . $sOutFile))
344 344
             {
345 345
                 file_put_contents($sJsAppDir . $sOutFile, $this->_getScript());
346 346
             }
347
-            if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
347
+            if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
348 348
             {
349
-                if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
349
+                if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
350 350
                 {
351 351
                     $sOutFile = $sMinFile;
352 352
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -357,8 +357,7 @@
 block discarded – undo
357 357
                 'sJsOptions' => $this->getOption('js.app.options'),
358 358
                 'sUrl' => $sJsAppURI . $sOutFile,
359 359
             ));
360
-        }
361
-        else
360
+        } else
362 361
         {
363 362
             // The plugins scripts are wrapped with javascript tags
364 363
             $sScript = $this->render('jaxon::plugins/wrapper.js', array(
Please login to merge, or discard this patch.
src/Request/Plugin/CallableClass.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $this->xRepository = $xRepository;
62 62
 
63
-        if(!empty($_GET['jxncls']))
63
+        if (!empty($_GET['jxncls']))
64 64
         {
65 65
             $this->sRequestedClass = $_GET['jxncls'];
66 66
         }
67
-        if(!empty($_GET['jxnmthd']))
67
+        if (!empty($_GET['jxnmthd']))
68 68
         {
69 69
             $this->sRequestedMethod = $_GET['jxnmthd'];
70 70
         }
71
-        if(!empty($_POST['jxncls']))
71
+        if (!empty($_POST['jxncls']))
72 72
         {
73 73
             $this->sRequestedClass = $_POST['jxncls'];
74 74
         }
75
-        if(!empty($_POST['jxnmthd']))
75
+        if (!empty($_POST['jxnmthd']))
76 76
         {
77 77
             $this->sRequestedMethod = $_POST['jxnmthd'];
78 78
         }
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function register($sType, $sClassName, $aOptions)
101 101
     {
102
-        if($sType != $this->getName())
102
+        if ($sType != $this->getName())
103 103
         {
104 104
             return false;
105 105
         }
106 106
 
107
-        if(!is_string($sClassName))
107
+        if (!is_string($sClassName))
108 108
         {
109 109
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
110 110
         }
111
-        if(is_string($aOptions))
111
+        if (is_string($aOptions))
112 112
         {
113 113
             $aOptions = ['include' => $aOptions];
114 114
         }
115
-        if(!is_array($aOptions))
115
+        if (!is_array($aOptions))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
118 118
         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
     public function canProcessRequest()
151 151
     {
152 152
         // Check the validity of the class name
153
-        if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
153
+        if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
154 154
         {
155 155
             $this->sRequestedClass = null;
156 156
             $this->sRequestedMethod = null;
157 157
         }
158 158
         // Check the validity of the method name
159
-        if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
159
+        if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
160 160
         {
161 161
             $this->sRequestedClass = null;
162 162
             $this->sRequestedMethod = null;
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function processRequest()
173 173
     {
174
-        if(!$this->canProcessRequest())
174
+        if (!$this->canProcessRequest())
175 175
         {
176 176
             return false;
177 177
         }
178 178
 
179 179
         // Find the requested method
180 180
         $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass);
181
-        if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
181
+        if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
182 182
         {
183 183
             // Unable to find the requested object or method
184 184
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $jaxon = jaxon();
190 190
         $aArgs = $jaxon->getRequestHandler()->processArguments();
191 191
         $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs);
192
-        if(($xResponse))
192
+        if (($xResponse))
193 193
         {
194 194
             $jaxon->getResponseManager()->append($xResponse);
195 195
         }
Please login to merge, or discard this patch.