Completed
Push — master ( f42a52...0a9499 )
by Thierry
02:50 queued 01:16
created
src/Request/Support/CallableRepository.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         // Set the composer autoloader
86 86
         $sAutoloadFile = __DIR__ . '/../../../../../autoload.php';
87
-        if(file_exists($sAutoloadFile))
87
+        if (file_exists($sAutoloadFile))
88 88
         {
89 89
             $this->xAutoloader = require($sAutoloadFile);
90 90
         }
@@ -115,19 +115,19 @@  discard block
 block discarded – undo
115 115
     private function getClassOptions($sClassName, array $aDirectoryOptions, array $aDefaultOptions = [])
116 116
     {
117 117
         $aOptions = $aDefaultOptions;
118
-        if(key_exists('separator', $aDirectoryOptions))
118
+        if (key_exists('separator', $aDirectoryOptions))
119 119
         {
120 120
             $aOptions['separator'] = $aDirectoryOptions['separator'];
121 121
         }
122
-        if(key_exists('protected', $aDirectoryOptions))
122
+        if (key_exists('protected', $aDirectoryOptions))
123 123
         {
124 124
             $aOptions['protected'] = $aDirectoryOptions['protected'];
125 125
         }
126
-        if(key_exists('*', $aDirectoryOptions))
126
+        if (key_exists('*', $aDirectoryOptions))
127 127
         {
128 128
             $aOptions = array_merge($aOptions, $aDirectoryOptions['*']);
129 129
         }
130
-        if(key_exists($sClassName, $aDirectoryOptions))
130
+        if (key_exists($sClassName, $aDirectoryOptions))
131 131
         {
132 132
             $aOptions = array_merge($aOptions, $aDirectoryOptions[$sClassName]);
133 133
         }
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
         $itDir = new RecursiveDirectoryIterator($sDirectory);
148 148
         $itFile = new RecursiveIteratorIterator($itDir);
149 149
         // Iterate on dir content
150
-        foreach($itFile as $xFile)
150
+        foreach ($itFile as $xFile)
151 151
         {
152 152
             // skip everything except PHP files
153
-            if(!$xFile->isFile() || $xFile->getExtension() != 'php')
153
+            if (!$xFile->isFile() || $xFile->getExtension() != 'php')
154 154
             {
155 155
                 continue;
156 156
             }
157 157
 
158 158
             $aClassOptions = [];
159 159
             // No more classmap autoloading. The file will be included when needed.
160
-            if(($aOptions['autoload']))
160
+            if (($aOptions['autoload']))
161 161
             {
162 162
                 $aClassOptions['include'] = $xFile->getPathname();
163 163
             }
@@ -178,26 +178,26 @@  discard block
 block discarded – undo
178 178
     public function addNamespace($sNamespace, array $aOptions)
179 179
     {
180 180
         // Separator default value
181
-        if(!key_exists('separator', $aOptions))
181
+        if (!key_exists('separator', $aOptions))
182 182
         {
183 183
             $aOptions['separator'] = '.';
184 184
         }
185 185
         $aOptions['separator'] = trim($aOptions['separator']);
186
-        if(!in_array($aOptions['separator'], ['.', '_']))
186
+        if (!in_array($aOptions['separator'], ['.', '_']))
187 187
         {
188 188
             $aOptions['separator'] = '.';
189 189
         }
190
-        if($aOptions['separator'] == '_')
190
+        if ($aOptions['separator'] == '_')
191 191
         {
192 192
             $this->bUsingUnderscore = true;
193 193
         }
194 194
         // Set the autoload option default value
195
-        if(!key_exists('autoload', $aOptions))
195
+        if (!key_exists('autoload', $aOptions))
196 196
         {
197 197
             $aOptions['autoload'] = true;
198 198
         }
199 199
         // Register the dir with PSR4 autoloading
200
-        if(($aOptions['autoload']) && $this->xAutoloader != null)
200
+        if (($aOptions['autoload']) && $this->xAutoloader != null)
201 201
         {
202 202
             $this->xAutoloader->setPsr4($sNamespace . '\\', $aOptions['directory']);
203 203
         }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      */
215 215
     private function getOptionsFromClass($sClassName)
216 216
     {
217
-        if(!key_exists($sClassName, $this->aClassOptions))
217
+        if (!key_exists($sClassName, $this->aClassOptions))
218 218
         {
219 219
             return null; // Class not registered
220 220
         }
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
     private function getOptionsFromNamespace($sClassName, $sNamespace = null)
233 233
     {
234 234
         // Find the corresponding namespace
235
-        if($sNamespace === null)
235
+        if ($sNamespace === null)
236 236
         {
237
-            foreach(array_keys($this->aNamespaceOptions) as $_sNamespace)
237
+            foreach (array_keys($this->aNamespaceOptions) as $_sNamespace)
238 238
             {
239
-                if(substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\')
239
+                if (substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\')
240 240
                 {
241 241
                     $sNamespace = $_sNamespace;
242 242
                     break;
243 243
                 }
244 244
             }
245 245
         }
246
-        if($sNamespace === null)
246
+        if ($sNamespace === null)
247 247
         {
248 248
             return null; // Class not registered
249 249
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         // Get the class options
252 252
         $aOptions = $this->aNamespaceOptions[$sNamespace];
253 253
         $aDefaultOptions = ['namespace' => $sNamespace];
254
-        if(key_exists('separator', $aOptions))
254
+        if (key_exists('separator', $aOptions))
255 255
         {
256 256
             $aDefaultOptions['separator'] = $aOptions['separator'];
257 257
         }
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
     protected function _getCallableObject($sClassName, array $aOptions)
270 270
     {
271 271
         // Make sure the registered class exists
272
-        if(key_exists('include', $aOptions))
272
+        if (key_exists('include', $aOptions))
273 273
         {
274 274
             require_once($aOptions['include']);
275 275
         }
276
-        if(!class_exists($sClassName))
276
+        if (!class_exists($sClassName))
277 277
         {
278 278
             return null;
279 279
         }
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
         // Create the callable object
282 282
         $xCallableObject = new CallableObject($sClassName);
283 283
         $this->aCallableOptions[$sClassName] = [];
284
-        foreach($aOptions as $sName => $xValue)
284
+        foreach ($aOptions as $sName => $xValue)
285 285
         {
286
-            if(in_array($sName, ['separator', 'namespace', 'protected']))
286
+            if (in_array($sName, ['separator', 'namespace', 'protected']))
287 287
             {
288 288
                 $xCallableObject->configure($sName, $xValue);
289 289
             }
290
-            elseif(is_array($xValue) && $sName != 'include')
290
+            elseif (is_array($xValue) && $sName != 'include')
291 291
             {
292 292
                 // These options are to be included in javascript code.
293 293
                 $this->aCallableOptions[$sClassName][$sName] = $xValue;
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
         // at the beginning and the end of the class name.
325 325
         $sClassName = (string)$sClassName;
326 326
         $sClassName = trim(str_replace('.', '\\', $sClassName), '\\');
327
-        if($this->bUsingUnderscore)
327
+        if ($this->bUsingUnderscore)
328 328
         {
329 329
             $sClassName = trim(str_replace('_', '\\', $sClassName), '\\');
330 330
         }
331 331
 
332
-        if(key_exists($sClassName, $this->aCallableObjects))
332
+        if (key_exists($sClassName, $this->aCallableObjects))
333 333
         {
334 334
             return $this->aCallableObjects[$sClassName];
335 335
         }
336 336
 
337 337
         $aOptions = $this->getOptionsFromClass($sClassName);
338
-        if($aOptions === null)
338
+        if ($aOptions === null)
339 339
         {
340 340
             $aOptions = $this->getOptionsFromNamespace($sClassName);
341 341
         }
342
-        if($aOptions === null)
342
+        if ($aOptions === null)
343 343
         {
344 344
             return null;
345 345
         }
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
     public function createCallableObjects()
356 356
     {
357 357
         // Create callable objects for registered classes
358
-        foreach($this->aClassOptions as $sClassName => $aClassOptions)
358
+        foreach ($this->aClassOptions as $sClassName => $aClassOptions)
359 359
         {
360
-            if(!key_exists($sClassName, $this->aCallableObjects))
360
+            if (!key_exists($sClassName, $this->aCallableObjects))
361 361
             {
362 362
                 $this->_getCallableObject($sClassName, $aClassOptions);
363 363
             }
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 
366 366
         // Create callable objects for registered namespaces
367 367
         $sDS = DIRECTORY_SEPARATOR;
368
-        foreach($this->aNamespaceOptions as $sNamespace => $aOptions)
368
+        foreach ($this->aNamespaceOptions as $sNamespace => $aOptions)
369 369
         {
370
-            if(key_exists($sNamespace, $this->aNamespaces))
370
+            if (key_exists($sNamespace, $this->aNamespaces))
371 371
             {
372 372
                 continue;
373 373
             }
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
             $sDirectory = $aOptions['directory'];
379 379
             $itDir = new RecursiveDirectoryIterator($sDirectory);
380 380
             $itFile = new RecursiveIteratorIterator($itDir);
381
-            foreach($itFile as $xFile)
381
+            foreach ($itFile as $xFile)
382 382
             {
383 383
                 // skip everything except PHP files
384
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
384
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
385 385
                 {
386 386
                     continue;
387 387
                 }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                 $sClassPath = $sNamespace;
391 391
                 $sRelativePath = substr($xFile->getPath(), strlen($sDirectory));
392 392
                 $sRelativePath = trim(str_replace($sDS, '\\', $sRelativePath), '\\');
393
-                if($sRelativePath != '')
393
+                if ($sRelativePath != '')
394 394
                 {
395 395
                     $sClassPath .= '\\' . $sRelativePath;
396 396
                 }
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
                 $this->aNamespaces[$sClassPath] = ['separator' => $aOptions['separator']];
399 399
                 $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php');
400 400
 
401
-                if(!key_exists($sClassName, $this->aCallableObjects))
401
+                if (!key_exists($sClassName, $this->aCallableObjects))
402 402
                 {
403 403
                     $aClassOptions = $this->getOptionsFromNamespace($sClassName, $sNamespace);
404
-                    if($aClassOptions !== null)
404
+                    if ($aClassOptions !== null)
405 405
                     {
406 406
                         $this->_getCallableObject($sClassName, $aClassOptions);
407 407
                     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -286,8 +286,7 @@
 block discarded – undo
286 286
             if(in_array($sName, ['separator', 'namespace', 'protected']))
287 287
             {
288 288
                 $xCallableObject->configure($sName, $xValue);
289
-            }
290
-            elseif(is_array($xValue) && $sName != 'include')
289
+            } elseif(is_array($xValue) && $sName != 'include')
291 290
             {
292 291
                 // These options are to be included in javascript code.
293 292
                 $this->aCallableOptions[$sClassName][$sName] = $xValue;
Please login to merge, or discard this patch.
src/Request/Support/CallableObject.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -138,29 +138,29 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function configure($sName, $sValue)
140 140
     {
141
-        switch($sName)
141
+        switch ($sName)
142 142
         {
143 143
         // Set the separator
144 144
         case 'separator':
145
-            if($sValue == '_' || $sValue == '.')
145
+            if ($sValue == '_' || $sValue == '.')
146 146
             {
147 147
                 $this->sSeparator = $sValue;
148 148
             }
149 149
             break;
150 150
         // Set the namespace
151 151
         case 'namespace':
152
-            if(is_string($sValue))
152
+            if (is_string($sValue))
153 153
             {
154 154
                 $this->sNamespace = $sValue;
155 155
             }
156 156
             break;
157 157
         // Set the protected methods
158 158
         case 'protected':
159
-            if(is_array($sValue))
159
+            if (is_array($sValue))
160 160
             {
161 161
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
162 162
             }
163
-            elseif(is_string($sValue))
163
+            elseif (is_string($sValue))
164 164
             {
165 165
                 $this->aProtectedMethods[] = $sValue;
166 166
             }
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
     public function getMethods()
179 179
     {
180 180
         $aMethods = [];
181
-        foreach($this->xReflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
181
+        foreach ($this->xReflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
182 182
         {
183 183
             $sMethodName = $xMethod->getShortName();
184 184
             // Don't take magic __call, __construct, __destruct methods
185
-            if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
185
+            if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
186 186
             {
187 187
                 continue;
188 188
             }
189 189
             // Don't take excluded methods
190
-            if(in_array($sMethodName, $this->aProtectedMethods))
190
+            if (in_array($sMethodName, $this->aProtectedMethods))
191 191
             {
192 192
                 continue;
193 193
             }
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function getRegisteredObject()
205 205
     {
206
-        if($this->xRegisteredObject == null)
206
+        if ($this->xRegisteredObject == null)
207 207
         {
208 208
             $di = jaxon()->di();
209 209
             // Use the Reflection class to get the parameters of the constructor
210
-            if(($constructor = $this->xReflectionClass->getConstructor()) != null)
210
+            if (($constructor = $this->xReflectionClass->getConstructor()) != null)
211 211
             {
212 212
                 $parameters = $constructor->getParameters();
213 213
                 $parameterInstances = [];
214
-                foreach($parameters as $parameter)
214
+                foreach ($parameters as $parameter)
215 215
                 {
216 216
                     // Get the parameter instance from the DI
217 217
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             }
225 225
 
226 226
             // Initialize the object
227
-            if($this->xRegisteredObject instanceof \Jaxon\CallableClass)
227
+            if ($this->xRegisteredObject instanceof \Jaxon\CallableClass)
228 228
             {
229 229
                 $this->xRegisteredObject->response = jaxon()->getResponse();
230 230
             }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public function call($sMethod, $aArgs)
256 256
     {
257
-        if(!$this->hasMethod($sMethod))
257
+        if (!$this->hasMethod($sMethod))
258 258
         {
259 259
             return;
260 260
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,8 +159,7 @@  discard block
 block discarded – undo
159 159
             if(is_array($sValue))
160 160
             {
161 161
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
162
-            }
163
-            elseif(is_string($sValue))
162
+            } elseif(is_string($sValue))
164 163
             {
165 164
                 $this->aProtectedMethods[] = $sValue;
166 165
             }
@@ -217,8 +216,7 @@  discard block
 block discarded – undo
217 216
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
218 217
                 }
219 218
                 $this->xRegisteredObject = $this->xReflectionClass->newInstanceArgs($parameterInstances);
220
-            }
221
-            else
219
+            } else
222 220
             {
223 221
                 $this->xRegisteredObject = $this->xReflectionClass->newInstance();
224 222
             }
Please login to merge, or discard this patch.
src/Request/Handler/Argument.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
         $this->aArgs = [];
59 59
         $this->nMethod = self::METHOD_UNKNOWN;
60 60
 
61
-        if(isset($_POST['jxnargs']))
61
+        if (isset($_POST['jxnargs']))
62 62
         {
63 63
             $this->nMethod = self::METHOD_POST;
64 64
             $this->aArgs = $_POST['jxnargs'];
65 65
         }
66
-        elseif(isset($_GET['jxnargs']))
66
+        elseif (isset($_GET['jxnargs']))
67 67
         {
68 68
             $this->nMethod = self::METHOD_GET;
69 69
             $this->aArgs = $_GET['jxnargs'];
70 70
         }
71
-        if(get_magic_quotes_gpc() == 1)
71
+        if (get_magic_quotes_gpc() == 1)
72 72
         {
73 73
             array_walk($this->aArgs, [&$this, '__argumentStripSlashes']);
74 74
         }
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
      */
85 85
     private function __convertStringToBool($sValue)
86 86
     {
87
-        if(strcasecmp($sValue, 'true') == 0)
87
+        if (strcasecmp($sValue, 'true') == 0)
88 88
         {
89 89
             return true;
90 90
         }
91
-        if(strcasecmp($sValue, 'false') == 0)
91
+        if (strcasecmp($sValue, 'false') == 0)
92 92
         {
93 93
             return false;
94 94
         }
95
-        if(is_numeric($sValue))
95
+        if (is_numeric($sValue))
96 96
         {
97
-            if($sValue == 0)
97
+            if ($sValue == 0)
98 98
             {
99 99
                 return false;
100 100
             }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function __argumentStripSlashes(&$sArg)
114 114
     {
115
-        if(!is_string($sArg))
115
+        if (!is_string($sArg))
116 116
         {
117 117
             return '';
118 118
         }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     private function __argumentDecode(&$sArg)
162 162
     {
163
-        if($sArg == '')
163
+        if ($sArg == '')
164 164
         {
165 165
             return '';
166 166
         }
@@ -169,22 +169,22 @@  discard block
 block discarded – undo
169 169
         $sType = 'multipart/form-data';
170 170
         $iLen = strlen($sType);
171 171
         $sContentType = '';
172
-        if(key_exists('CONTENT_TYPE', $_SERVER))
172
+        if (key_exists('CONTENT_TYPE', $_SERVER))
173 173
         {
174 174
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
175 175
         }
176
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
176
+        elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER))
177 177
         {
178 178
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
179 179
         }
180
-        if($sContentType == $sType)
180
+        if ($sContentType == $sType)
181 181
         {
182 182
             $sArg = urldecode($sArg);
183 183
         }
184 184
 
185 185
         $data = json_decode($sArg, true);
186 186
 
187
-        if($data !== null && $sArg != $data)
187
+        if ($data !== null && $sArg != $data)
188 188
         {
189 189
             $sArg = $data;
190 190
         }
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
      */
204 204
     private function __argumentDecodeUTF8_iconv(&$mArg)
205 205
     {
206
-        if(is_array($mArg))
206
+        if (is_array($mArg))
207 207
         {
208
-            foreach($mArg as $sKey => &$xArg)
208
+            foreach ($mArg as $sKey => &$xArg)
209 209
             {
210 210
                 $sNewKey = $sKey;
211 211
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
212
-                if($sNewKey != $sKey)
212
+                if ($sNewKey != $sKey)
213 213
                 {
214 214
                     $mArg[$sNewKey] = $xArg;
215 215
                     unset($mArg[$sKey]);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 $this->__argumentDecodeUTF8_iconv($xArg);
219 219
             }
220 220
         }
221
-        elseif(is_string($mArg))
221
+        elseif (is_string($mArg))
222 222
         {
223 223
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
224 224
         }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
      */
234 234
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
235 235
     {
236
-        if(is_array($mArg))
236
+        if (is_array($mArg))
237 237
         {
238
-            foreach($mArg as $sKey => &$xArg)
238
+            foreach ($mArg as $sKey => &$xArg)
239 239
             {
240 240
                 $sNewKey = $sKey;
241 241
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
242
-                if($sNewKey != $sKey)
242
+                if ($sNewKey != $sKey)
243 243
                 {
244 244
                     $mArg[$sNewKey] = $xArg;
245 245
                     unset($mArg[$sKey]);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
249 249
             }
250 250
         }
251
-        elseif(is_string($mArg))
251
+        elseif (is_string($mArg))
252 252
         {
253 253
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
254 254
         }
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
      */
264 264
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
265 265
     {
266
-        if(is_array($mArg))
266
+        if (is_array($mArg))
267 267
         {
268
-            foreach($mArg as $sKey => &$xArg)
268
+            foreach ($mArg as $sKey => &$xArg)
269 269
             {
270 270
                 $sNewKey = $sKey;
271 271
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
272 272
 
273
-                if($sNewKey != $sKey)
273
+                if ($sNewKey != $sKey)
274 274
                 {
275 275
                     $mArg[$sNewKey] = $xArg;
276 276
                     unset($mArg[$sKey]);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
281 281
             }
282 282
         }
283
-        elseif(is_string($mArg))
283
+        elseif (is_string($mArg))
284 284
         {
285 285
             $mArg = utf8_decode($mArg);
286 286
         }
@@ -305,19 +305,19 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function process()
307 307
     {
308
-        if(($this->getOption('core.decode_utf8')))
308
+        if (($this->getOption('core.decode_utf8')))
309 309
         {
310 310
             $sFunction = '';
311 311
 
312
-            if(function_exists('iconv'))
312
+            if (function_exists('iconv'))
313 313
             {
314 314
                 $sFunction = "iconv";
315 315
             }
316
-            elseif(function_exists('mb_convert_encoding'))
316
+            elseif (function_exists('mb_convert_encoding'))
317 317
             {
318 318
                 $sFunction = "mb_convert_encoding";
319 319
             }
320
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
320
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
321 321
             {
322 322
                 $sFunction = "utf8_decode";
323 323
             }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
         {
63 63
             $this->nMethod = self::METHOD_POST;
64 64
             $this->aArgs = $_POST['jxnargs'];
65
-        }
66
-        elseif(isset($_GET['jxnargs']))
65
+        } elseif(isset($_GET['jxnargs']))
67 66
         {
68 67
             $this->nMethod = self::METHOD_GET;
69 68
             $this->aArgs = $_GET['jxnargs'];
@@ -172,8 +171,7 @@  discard block
 block discarded – undo
172 171
         if(key_exists('CONTENT_TYPE', $_SERVER))
173 172
         {
174 173
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
175
-        }
176
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
174
+        } elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
177 175
         {
178 176
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
179 177
         }
@@ -187,8 +185,7 @@  discard block
 block discarded – undo
187 185
         if($data !== null && $sArg != $data)
188 186
         {
189 187
             $sArg = $data;
190
-        }
191
-        else
188
+        } else
192 189
         {
193 190
             $sArg = $this->__convertValue($sArg);
194 191
         }
@@ -217,8 +214,7 @@  discard block
 block discarded – undo
217 214
                 }
218 215
                 $this->__argumentDecodeUTF8_iconv($xArg);
219 216
             }
220
-        }
221
-        elseif(is_string($mArg))
217
+        } elseif(is_string($mArg))
222 218
         {
223 219
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
224 220
         }
@@ -247,8 +243,7 @@  discard block
 block discarded – undo
247 243
                 }
248 244
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
249 245
             }
250
-        }
251
-        elseif(is_string($mArg))
246
+        } elseif(is_string($mArg))
252 247
         {
253 248
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
254 249
         }
@@ -279,8 +274,7 @@  discard block
 block discarded – undo
279 274
 
280 275
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
281 276
             }
282
-        }
283
-        elseif(is_string($mArg))
277
+        } elseif(is_string($mArg))
284 278
         {
285 279
             $mArg = utf8_decode($mArg);
286 280
         }
@@ -312,16 +306,13 @@  discard block
 block discarded – undo
312 306
             if(function_exists('iconv'))
313 307
             {
314 308
                 $sFunction = "iconv";
315
-            }
316
-            elseif(function_exists('mb_convert_encoding'))
309
+            } elseif(function_exists('mb_convert_encoding'))
317 310
             {
318 311
                 $sFunction = "mb_convert_encoding";
319
-            }
320
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
312
+            } elseif($this->getOption('core.encoding') == "ISO-8859-1")
321 313
             {
322 314
                 $sFunction = "utf8_decode";
323
-            }
324
-            else
315
+            } else
325 316
             {
326 317
                 throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion'));
327 318
             }
Please login to merge, or discard this patch.
src/Request/Handler/Callback.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function before($xCallable = null)
53 53
     {
54
-        if($xCallable === null)
54
+        if ($xCallable === null)
55 55
         {
56 56
             return $this->xBeforeCallback;
57 57
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function after($xCallable = null)
69 69
     {
70
-        if($xCallable === null)
70
+        if ($xCallable === null)
71 71
         {
72 72
             return $this->xAfterCallback;
73 73
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function invalid($xCallable = null)
85 85
     {
86
-        if($xCallable === null)
86
+        if ($xCallable === null)
87 87
         {
88 88
             return $this->xInvalidCallback;
89 89
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function error($xCallable = null)
101 101
     {
102
-        if($xCallable === null)
102
+        if ($xCallable === null)
103 103
         {
104 104
             return $this->xErrorCallback;
105 105
         }
Please login to merge, or discard this patch.
src/Request/Plugin/CallableDir.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,47 +68,47 @@
 block discarded – undo
68 68
     public function register($sType, $sDirectory, $aOptions)
69 69
     {
70 70
         $sType = trim($sType);
71
-        if($sType != $this->getName())
71
+        if ($sType != $this->getName())
72 72
         {
73 73
             return false;
74 74
         }
75 75
 
76
-        if(!is_string($sDirectory) || !is_dir($sDirectory))
76
+        if (!is_string($sDirectory) || !is_dir($sDirectory))
77 77
         {
78 78
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
79 79
         }
80
-        if(is_string($aOptions))
80
+        if (is_string($aOptions))
81 81
         {
82 82
             $aOptions = ['namespace' => $aOptions];
83 83
         }
84
-        if(!is_array($aOptions))
84
+        if (!is_array($aOptions))
85 85
         {
86 86
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
87 87
         }
88 88
 
89 89
         $sDirectory = rtrim(trim($sDirectory), '/\\');
90
-        if(!is_dir($sDirectory))
90
+        if (!is_dir($sDirectory))
91 91
         {
92 92
             return false;
93 93
         }
94 94
         $aOptions['directory'] = realpath($sDirectory);
95 95
 
96 96
         $sNamespace = key_exists('namespace', $aOptions) ? $aOptions['namespace'] : '';
97
-        if(!($sNamespace = trim($sNamespace, ' \\')))
97
+        if (!($sNamespace = trim($sNamespace, ' \\')))
98 98
         {
99 99
             $sNamespace = '';
100 100
         }
101 101
 
102 102
         // Change the keys in $aOptions to have "\" as separator
103 103
         $_aOptions = [];
104
-        foreach($aOptions as $sName => $aOption)
104
+        foreach ($aOptions as $sName => $aOption)
105 105
         {
106 106
             $sName = trim(str_replace('.', '\\', $sName), ' \\');
107 107
             $_aOptions[$sName] = $aOption;
108 108
         }
109 109
         $aOptions = $_aOptions;
110 110
 
111
-        if(($sNamespace))
111
+        if (($sNamespace))
112 112
         {
113 113
             $this->xRepository->addNamespace($sNamespace, $aOptions);
114 114
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@
 block discarded – undo
111 111
         if(($sNamespace))
112 112
         {
113 113
             $this->xRepository->addNamespace($sNamespace, $aOptions);
114
-        }
115
-        else
114
+        } else
116 115
         {
117 116
             $this->xRepository->addDirectory($sDirectory, $aOptions);
118 117
         }
Please login to merge, or discard this patch.
src/Request/Plugin/CallableClass.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $this->xRepository = $xRepository;
66 66
 
67
-        if(!empty($_GET['jxncls']))
67
+        if (!empty($_GET['jxncls']))
68 68
         {
69 69
             $this->sRequestedClass = trim($_GET['jxncls']);
70 70
         }
71
-        if(!empty($_GET['jxnmthd']))
71
+        if (!empty($_GET['jxnmthd']))
72 72
         {
73 73
             $this->sRequestedMethod = trim($_GET['jxnmthd']);
74 74
         }
75
-        if(!empty($_POST['jxncls']))
75
+        if (!empty($_POST['jxncls']))
76 76
         {
77 77
             $this->sRequestedClass = trim($_POST['jxncls']);
78 78
         }
79
-        if(!empty($_POST['jxnmthd']))
79
+        if (!empty($_POST['jxnmthd']))
80 80
         {
81 81
             $this->sRequestedMethod = trim($_POST['jxnmthd']);
82 82
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function getTarget()
101 101
     {
102
-        if(!$this->sRequestedClass || !$this->sRequestedMethod)
102
+        if (!$this->sRequestedClass || !$this->sRequestedMethod)
103 103
         {
104 104
             return null;
105 105
         }
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
     public function register($sType, $sClassName, $aOptions)
119 119
     {
120 120
         $sType = trim($sType);
121
-        if($sType != $this->getName())
121
+        if ($sType != $this->getName())
122 122
         {
123 123
             return false;
124 124
         }
125 125
 
126
-        if(!is_string($sClassName))
126
+        if (!is_string($sClassName))
127 127
         {
128 128
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
129 129
         }
130
-        if(is_string($aOptions))
130
+        if (is_string($aOptions))
131 131
         {
132 132
             $aOptions = ['include' => $aOptions];
133 133
         }
134
-        if(!is_array($aOptions))
134
+        if (!is_array($aOptions))
135 135
         {
136 136
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
137 137
         }
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
         $aCallableObjects = $this->xRepository->getCallableObjects();
155 155
         $sHash = '';
156 156
 
157
-        foreach($aNamespaces as $sNamespace => $aOptions)
157
+        foreach ($aNamespaces as $sNamespace => $aOptions)
158 158
         {
159 159
             $sHash .= $sNamespace . $aOptions['separator'];
160 160
         }
161
-        foreach($aCallableObjects as $sClassName => $xCallableObject)
161
+        foreach ($aCallableObjects as $sClassName => $xCallableObject)
162 162
         {
163 163
             $sHash .= $sClassName . implode('|', $xCallableObject->getMethods());
164 164
         }
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
 
184 184
         $xCallableClass = new \ReflectionClass(UserCallableClass::class);
185 185
         $aCallableMethods = [];
186
-        foreach($xCallableClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
186
+        foreach ($xCallableClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
187 187
         {
188 188
             $aCallableMethods[] = $xMethod->getName();
189 189
         }
190 190
 
191
-        foreach(array_keys($aNamespaces) as $sNamespace)
191
+        foreach (array_keys($aNamespaces) as $sNamespace)
192 192
         {
193 193
             $offset = 0;
194 194
             $sJsNamespace = str_replace('\\', '.', $sNamespace);
195 195
             $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop.
196
-            while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
196
+            while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
197 197
             {
198 198
                 $sJsClass = substr($sJsNamespace, 0, $dotPosition);
199 199
                 // Generate code for this object
200
-                if(!key_exists($sJsClass, $aJsClasses))
200
+                if (!key_exists($sJsClass, $aJsClasses))
201 201
                 {
202 202
                     $sCode .= "$sPrefix$sJsClass = {};\n";
203 203
                     $aJsClasses[$sJsClass] = $sJsClass;
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
             }
207 207
         }
208 208
 
209
-        foreach($aCallableObjects as $sClassName => $xCallableObject)
209
+        foreach ($aCallableObjects as $sClassName => $xCallableObject)
210 210
         {
211 211
             $aConfig = $aCallableOptions[$sClassName];
212 212
             $aCommonConfig = key_exists('*', $aConfig) ? $aConfig['*'] : [];
213 213
 
214 214
             $aProtectedMethods = is_subclass_of($sClassName, UserCallableClass::class) ? $aCallableMethods : [];
215 215
             $aMethods = [];
216
-            foreach($xCallableObject->getMethods() as $sMethodName)
216
+            foreach ($xCallableObject->getMethods() as $sMethodName)
217 217
             {
218 218
                 // Don't export methods of the CallableClass class
219
-                if(in_array($sMethodName, $aProtectedMethods))
219
+                if (in_array($sMethodName, $aProtectedMethods))
220 220
                 {
221 221
                     continue;
222 222
                 }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     public function canProcessRequest()
248 248
     {
249 249
         // Check the validity of the class name
250
-        if(($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) ||
250
+        if (($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) ||
251 251
             ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)))
252 252
         {
253 253
             $this->sRequestedClass = null;
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
      */
264 264
     public function processRequest()
265 265
     {
266
-        if(!$this->canProcessRequest())
266
+        if (!$this->canProcessRequest())
267 267
         {
268 268
             return false;
269 269
         }
270 270
 
271 271
         // Find the requested method
272 272
         $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass);
273
-        if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
273
+        if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
274 274
         {
275 275
             // Unable to find the requested object or method
276 276
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid',
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $di = jaxon()->di();
282 282
         $aArgs = $di->getRequestHandler()->processArguments();
283 283
         $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs);
284
-        if(($xResponse))
284
+        if (($xResponse))
285 285
         {
286 286
             $di->getResponseManager()->append($xResponse);
287 287
         }
Please login to merge, or discard this patch.
src/Request/Target.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,11 +100,11 @@
 block discarded – undo
100 100
         return new Target(self::TYPE_CLASS, '', $sClassName, $sMethodName);
101 101
     }
102 102
 
103
-     /**
104
-     * Check if the target type is Function.
105
-     *
106
-     * @return bool
107
-     */
103
+        /**
104
+         * Check if the target type is Function.
105
+         *
106
+         * @return bool
107
+         */
108 108
     public function isFunction()
109 109
     {
110 110
         return $this->sType == self::TYPE_FUNCTION;
Please login to merge, or discard this patch.
src/Features/View/Namespaces.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     {
61 61
         $this->sDirectory = '';
62 62
         $this->sExtension = '';
63
-        if(key_exists($sNamespace, $this->aDirectories))
63
+        if (key_exists($sNamespace, $this->aDirectories))
64 64
         {
65 65
             // Make sure there's only one '/' at the end of the string
66 66
             $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/';
Please login to merge, or discard this patch.