Completed
Push — master ( 5d7b0f...8d92ea )
by Thierry
03:20
created
src/Response/Plugin/JQuery/Dom/Element.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         $this->aCalls = [];
59 59
 
60 60
         $jQueryNs = jaxon()->getOption('core.jquery.no_conflict', false) ? 'jQuery' : '$';
61
-        if(!$sSelector)
61
+        if (!$sSelector)
62 62
         {
63 63
             $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead
64 64
         }
65
-        elseif(($sContext))
65
+        elseif (($sContext))
66 66
         {
67 67
             $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))";
68 68
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function getScript()
120 120
     {
121
-        if(count($this->aCalls) == 0)
121
+        if (count($this->aCalls) == 0)
122 122
         {
123 123
             return $this->sSelector;
124 124
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,12 +57,10 @@
 block discarded – undo
57 57
         if(!$sSelector)
58 58
         {
59 59
             $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead
60
-        }
61
-        elseif(($sContext))
60
+        } elseif(($sContext))
62 61
         {
63 62
             $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))";
64
-        }
65
-        else
63
+        } else
66 64
         {
67 65
             $this->sSelector = "$jQueryNs('" . $sSelector . "')";
68 66
         }
Please login to merge, or discard this patch.
src/Utils/Template/Renderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function render($sPath, array $aVars = [])
28 28
     {
29 29
         // Make the template vars available as attributes
30
-        foreach($aVars as $sName => $xValue)
30
+        foreach ($aVars as $sName => $xValue)
31 31
         {
32 32
             $sName = (string)$sName;
33 33
             $this->$sName = $xValue;
Please login to merge, or discard this patch.
src/Request/Plugin/UserFunction.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      * @param string        $sUserFunction  The name of the function being registered
79 79
      * @param array|string  $aOptions       The associated options
80 80
      *
81
-     * @return \Jaxon\Request\Request
81
+     * @return boolean
82 82
      */
83 83
     public function register($sType, $sUserFunction, $aOptions)
84 84
     {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function __construct()
47 47
     {
48
-        if(isset($_GET['jxnfun']))
48
+        if (isset($_GET['jxnfun']))
49 49
         {
50 50
             $this->sRequestedFunction = $_GET['jxnfun'];
51 51
         }
52
-        if(isset($_POST['jxnfun']))
52
+        if (isset($_POST['jxnfun']))
53 53
         {
54 54
             $this->sRequestedFunction = $_POST['jxnfun'];
55 55
         }
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function register($sType, $sUserFunction, $aOptions)
78 78
     {
79
-        if($sType != $this->getName())
79
+        if ($sType != $this->getName())
80 80
         {
81 81
             return false;
82 82
         }
83 83
 
84
-        if(!is_string($sUserFunction))
84
+        if (!is_string($sUserFunction))
85 85
         {
86 86
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
87 87
         }
88 88
 
89
-        if(is_string($aOptions))
89
+        if (is_string($aOptions))
90 90
         {
91 91
             $aOptions = ['include' => $aOptions];
92 92
         }
93
-        if(!is_array($aOptions))
93
+        if (!is_array($aOptions))
94 94
         {
95 95
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
96 96
         }
97 97
 
98 98
         // Check if an alias is defined
99 99
         $sFunctionName = $sUserFunction;
100
-        foreach($aOptions as $sName => $sValue)
100
+        foreach ($aOptions as $sName => $sValue)
101 101
         {
102
-            if($sName == 'alias')
102
+            if ($sName == 'alias')
103 103
             {
104 104
                 $sFunctionName = $sValue;
105 105
                 break;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         $this->aFunctions[$sFunctionName] = $aOptions;
110
-        jaxon()->di()->set($sFunctionName, function () use ($sFunctionName, $sUserFunction) {
110
+        jaxon()->di()->set($sFunctionName, function() use ($sFunctionName, $sUserFunction) {
111 111
             $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction);
112 112
 
113 113
             $aOptions = $this->aFunctions[$sFunctionName];
114
-            foreach($aOptions as $sName => $sValue)
114
+            foreach ($aOptions as $sName => $sValue)
115 115
             {
116 116
                 $xUserFunction->configure($sName, $sValue);
117 117
             }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $di = jaxon()->di();
143 143
         $code = '';
144
-        foreach(array_keys($this->aFunctions) as $sName)
144
+        foreach (array_keys($this->aFunctions) as $sName)
145 145
         {
146 146
             $xFunction = $di->get($sName);
147 147
             $code .= $xFunction->getScript();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function canProcessRequest()
158 158
     {
159 159
         // Check the validity of the function name
160
-        if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
160
+        if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
161 161
         {
162 162
             $this->sRequestedFunction = null;
163 163
         }
@@ -171,13 +171,13 @@  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
         // Security check: make sure the requested function was registered.
180
-        if(!key_exists($this->sRequestedFunction, $this->aFunctions))
180
+        if (!key_exists($this->sRequestedFunction, $this->aFunctions))
181 181
         {
182 182
             // Unable to find the requested function
183 183
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $jaxon = jaxon();
189 189
         $aArgs = $jaxon->getRequestHandler()->processArguments();
190 190
         $xResponse = $xFunction->call($aArgs);
191
-        if(($xResponse))
191
+        if (($xResponse))
192 192
         {
193 193
             $jaxon->getResponseManager()->append($xResponse);
194 194
         }
Please login to merge, or discard this patch.
src/Request/Support/CallableObject.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
             if(is_array($sValue))
135 135
             {
136 136
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
137
-            }
138
-            elseif(is_string($sValue))
137
+            } elseif(is_string($sValue))
139 138
             {
140 139
                 $this->aProtectedMethods[] = $sValue;
141 140
             }
@@ -192,8 +191,7 @@  discard block
 block discarded – undo
192 191
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
193 192
                 }
194 193
                 $this->registeredObject = $this->reflectionClass->newInstanceArgs($parameterInstances);
195
-            }
196
-            else
194
+            } else
197 195
             {
198 196
                 $this->registeredObject = $this->reflectionClass->newInstance();
199 197
             }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function configure($sName, $sValue)
122 122
     {
123
-        switch($sName)
123
+        switch ($sName)
124 124
         {
125 125
         // Set the separator
126 126
         case 'separator':
127
-            if($sValue == '_' || $sValue == '.')
127
+            if ($sValue == '_' || $sValue == '.')
128 128
             {
129 129
                 $this->separator = $sValue;
130 130
             }
131 131
             break;
132 132
         // Set the protected methods
133 133
         case 'protected':
134
-            if(is_array($sValue))
134
+            if (is_array($sValue))
135 135
             {
136 136
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
137 137
             }
138
-            elseif(is_string($sValue))
138
+            elseif (is_string($sValue))
139 139
             {
140 140
                 $this->aProtectedMethods[] = $sValue;
141 141
             }
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
     public function getMethods()
154 154
     {
155 155
         $aMethods = [];
156
-        foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
156
+        foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
157 157
         {
158 158
             $sMethodName = $xMethod->getShortName();
159 159
             // Don't take magic __call, __construct, __destruct methods
160
-            if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
160
+            if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
161 161
             {
162 162
                 continue;
163 163
             }
164 164
             // Don't take excluded methods
165
-            if(in_array($sMethodName, $this->aProtectedMethods))
165
+            if (in_array($sMethodName, $this->aProtectedMethods))
166 166
             {
167 167
                 continue;
168 168
             }
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function getRegisteredObject()
180 180
     {
181
-        if($this->registeredObject == null)
181
+        if ($this->registeredObject == null)
182 182
         {
183 183
             $di = jaxon()->di();
184 184
             // Use the Reflection class to get the parameters of the constructor
185
-            if(($constructor = $this->reflectionClass->getConstructor()) != null)
185
+            if (($constructor = $this->reflectionClass->getConstructor()) != null)
186 186
             {
187 187
                 $parameters = $constructor->getParameters();
188 188
                 $parameterInstances = [];
189
-                foreach($parameters as $parameter)
189
+                foreach ($parameters as $parameter)
190 190
                 {
191 191
                     // Get the parameter instance from the DI
192 192
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function call($sMethod, $aArgs)
225 225
     {
226
-        if(!$this->hasMethod($sMethod))
226
+        if (!$this->hasMethod($sMethod))
227 227
         {
228 228
             return;
229 229
         }
Please login to merge, or discard this patch.
src/Request/Support/CallableRepository.php 4 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -243,8 +243,7 @@
 block discarded – undo
243 243
             if($sName == 'separator' || $sName == 'protected')
244 244
             {
245 245
                 $xCallableObject->configure($sName, $xValue);
246
-            }
247
-            elseif(is_array($xValue) && $sName != 'include')
246
+            } elseif(is_array($xValue) && $sName != 'include')
248 247
             {
249 248
                 // These options are to be included in javascript code.
250 249
                 $this->aCallableOptions[$sClassName][$sName] = $xValue;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@
 block discarded – undo
222 222
      * @param string        $sClassName            The class name of the callable object
223 223
      * @param array         $aOptions              The callable object options
224 224
      *
225
-     * @return object
225
+     * @return null|CallableObject
226 226
      */
227 227
     protected function _getCallableObject($sClassName, array $aOptions)
228 228
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace Jaxon\Request\Support;
16 16
 
17 17
 use Jaxon\Request\Request;
18
-
19 18
 use RecursiveDirectoryIterator;
20 19
 use RecursiveIteratorIterator;
21 20
 // use RegexIterator;
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
     private function getClassOptions($sClassName, array $aDirectoryOptions, array $aDefaultOptions = [])
94 94
     {
95 95
         $aOptions = $aDefaultOptions;
96
-        if(key_exists('separator', $aDirectoryOptions))
96
+        if (key_exists('separator', $aDirectoryOptions))
97 97
         {
98 98
             $aOptions['separator'] = $aDirectoryOptions['separator'];
99 99
         }
100
-        if(key_exists('protected', $aDirectoryOptions))
100
+        if (key_exists('protected', $aDirectoryOptions))
101 101
         {
102 102
             $aOptions['protected'] = $aDirectoryOptions['protected'];
103 103
         }
104
-        if(key_exists('*', $aDirectoryOptions))
104
+        if (key_exists('*', $aDirectoryOptions))
105 105
         {
106 106
             $aOptions = array_merge($aOptions, $aDirectoryOptions['*']);
107 107
         }
108
-        if(key_exists($sClassName, $aDirectoryOptions))
108
+        if (key_exists($sClassName, $aDirectoryOptions))
109 109
         {
110 110
             $aOptions = array_merge($aOptions, $aDirectoryOptions[$sClassName]);
111 111
         }
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
         $itDir = new RecursiveDirectoryIterator($sDirectory);
126 126
         $itFile = new RecursiveIteratorIterator($itDir);
127 127
         // Iterate on dir content
128
-        foreach($itFile as $xFile)
128
+        foreach ($itFile as $xFile)
129 129
         {
130 130
             // skip everything except PHP files
131
-            if(!$xFile->isFile() || $xFile->getExtension() != 'php')
131
+            if (!$xFile->isFile() || $xFile->getExtension() != 'php')
132 132
             {
133 133
                 continue;
134 134
             }
135 135
 
136 136
             $aClassOptions = [];
137 137
             // No more classmap autoloading. The file will be included when needed.
138
-            if(($aOptions['autoload']))
138
+            if (($aOptions['autoload']))
139 139
             {
140 140
                 $aClassOptions['include'] = $xFile->getPathname();
141 141
             }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function addNamespace($sNamespace, array $aOptions)
157 157
     {
158 158
         // Separator default value
159
-        if(!key_exists('separator', $aOptions))
159
+        if (!key_exists('separator', $aOptions))
160 160
         {
161 161
             $aOptions['separator'] = '.';
162 162
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     private function getOptionsFromClass($sClassName)
174 174
     {
175
-        if(!key_exists($sClassName, $this->aClassOptions))
175
+        if (!key_exists($sClassName, $this->aClassOptions))
176 176
         {
177 177
             return null; // Class not registered
178 178
         }
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
     private function getOptionsFromNamespace($sClassName, $sNamespace = null)
191 191
     {
192 192
         // Find the corresponding namespace
193
-        if($sNamespace == null)
193
+        if ($sNamespace == null)
194 194
         {
195
-            foreach(array_keys($this->aNamespaceOptions) as $_sNamespace)
195
+            foreach (array_keys($this->aNamespaceOptions) as $_sNamespace)
196 196
             {
197
-                if(substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\')
197
+                if (substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\')
198 198
                 {
199 199
                     $sNamespace = $_sNamespace;
200 200
                     break;
201 201
                 }
202 202
             }
203 203
         }
204
-        if($sNamespace == null)
204
+        if ($sNamespace == null)
205 205
         {
206 206
             return null; // Class not registered
207 207
         }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         // Get the class options
210 210
         $aOptions = $this->aNamespaceOptions[$sNamespace];
211 211
         $aDefaultOptions = []; // ['namespace' => $aOptions['namespace']];
212
-        if(key_exists('separator', $aOptions))
212
+        if (key_exists('separator', $aOptions))
213 213
         {
214 214
             $aDefaultOptions['separator'] = $aOptions['separator'];
215 215
         }
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
     protected function _getCallableObject($sClassName, array $aOptions)
228 228
     {
229 229
         // Make sure the registered class exists
230
-        if(key_exists('include', $aOptions))
230
+        if (key_exists('include', $aOptions))
231 231
         {
232 232
             require_once($aOptions['include']);
233 233
         }
234
-        if(!class_exists($sClassName))
234
+        if (!class_exists($sClassName))
235 235
         {
236 236
             return null;
237 237
         }
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
         // Create the callable object
240 240
         $xCallableObject = new \Jaxon\Request\Support\CallableObject($sClassName);
241 241
         $this->aCallableOptions[$sClassName] = [];
242
-        foreach($aOptions as $sName => $xValue)
242
+        foreach ($aOptions as $sName => $xValue)
243 243
         {
244
-            if($sName == 'separator' || $sName == 'protected')
244
+            if ($sName == 'separator' || $sName == 'protected')
245 245
             {
246 246
                 $xCallableObject->configure($sName, $xValue);
247 247
             }
248
-            elseif(is_array($xValue) && $sName != 'include')
248
+            elseif (is_array($xValue) && $sName != 'include')
249 249
             {
250 250
                 // These options are to be included in javascript code.
251 251
                 $this->aCallableOptions[$sClassName][$sName] = $xValue;
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
         $this->aCallableObjects[$sClassName] = $xCallableObject;
255 255
 
256 256
         // Register the request factory for this callable object
257
-        jaxon()->di()->set($sClassName . '_Factory_Rq', function () use ($sClassName) {
257
+        jaxon()->di()->set($sClassName . '_Factory_Rq', function() use ($sClassName) {
258 258
             $xCallableObject = $this->aCallableObjects[$sClassName];
259 259
             return new \Jaxon\Factory\Request\Portable($xCallableObject);
260 260
         });
261 261
         // Register the paginator factory for this callable object
262
-        jaxon()->di()->set($sClassName . '_Factory_Pg', function () use ($sClassName) {
262
+        jaxon()->di()->set($sClassName . '_Factory_Pg', function() use ($sClassName) {
263 263
             $xCallableObject = $this->aCallableObjects[$sClassName];
264 264
             return new \Jaxon\Factory\Request\Paginator($xCallableObject);
265 265
         });
@@ -280,17 +280,17 @@  discard block
 block discarded – undo
280 280
         // at the beginning and the end of the class name.
281 281
         $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\');
282 282
 
283
-        if(key_exists($sClassName, $this->aCallableObjects))
283
+        if (key_exists($sClassName, $this->aCallableObjects))
284 284
         {
285 285
             return $this->aCallableObjects[$sClassName];
286 286
         }
287 287
 
288 288
         $aOptions = $this->getOptionsFromClass($sClassName);
289
-        if($aOptions === null)
289
+        if ($aOptions === null)
290 290
         {
291 291
             $aOptions = $this->getOptionsFromNamespace($sClassName);
292 292
         }
293
-        if($aOptions === null)
293
+        if ($aOptions === null)
294 294
         {
295 295
             return null;
296 296
         }
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
     private function createCallableObjects()
307 307
     {
308 308
         // Create callable objects for registered classes
309
-        foreach($this->aClassOptions as $sClassName => $aClassOptions)
309
+        foreach ($this->aClassOptions as $sClassName => $aClassOptions)
310 310
         {
311
-            if(!key_exists($sClassName, $this->aCallableObjects))
311
+            if (!key_exists($sClassName, $this->aCallableObjects))
312 312
             {
313 313
                 $this->_getCallableObject($sClassName, $aClassOptions);
314 314
             }
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 
317 317
         // Create callable objects for registered namespaces
318 318
         $sDS = DIRECTORY_SEPARATOR;
319
-        foreach($this->aNamespaceOptions as $sNamespace => $aOptions)
319
+        foreach ($this->aNamespaceOptions as $sNamespace => $aOptions)
320 320
         {
321
-            if(key_exists($sNamespace, $this->aNamespaces))
321
+            if (key_exists($sNamespace, $this->aNamespaces))
322 322
             {
323 323
                 continue;
324 324
             }
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
             $sDirectory = $aOptions['directory'];
330 330
             $itDir = new RecursiveDirectoryIterator($sDirectory);
331 331
             $itFile = new RecursiveIteratorIterator($itDir);
332
-            foreach($itFile as $xFile)
332
+            foreach ($itFile as $xFile)
333 333
             {
334 334
                 // skip everything except PHP files
335
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
335
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
336 336
                 {
337 337
                     continue;
338 338
                 }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                 $sClassPath = $sNamespace;
342 342
                 $sRelativePath = substr($xFile->getPath(), strlen($sDirectory));
343 343
                 $sRelativePath = trim(str_replace($sDS, '\\', $sRelativePath), '\\');
344
-                if($sRelativePath != '')
344
+                if ($sRelativePath != '')
345 345
                 {
346 346
                     $sClassPath .= '\\' . $sRelativePath;
347 347
                 }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                 $this->aNamespaces[$sClassPath] = ['separator' => $aOptions['separator']];
350 350
                 $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php');
351 351
 
352
-                if(!key_exists($sClassName, $this->aCallableObjects))
352
+                if (!key_exists($sClassName, $this->aCallableObjects))
353 353
                 {
354 354
                     $aClassOptions = $this->getOptionsFromNamespace($sClassName, $sNamespace);
355 355
                     $this->_getCallableObject($sClassName, $aClassOptions);
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
         $this->createCallableObjects();
383 383
 
384 384
         $sHash = '';
385
-        foreach($this->aNamespaces as $sNamespace => $aOptions)
385
+        foreach ($this->aNamespaces as $sNamespace => $aOptions)
386 386
         {
387 387
             $sHash .= $sNamespace . $aOptions['separator'];
388 388
         }
389
-        foreach($this->aCallableObjects as $sClassName => $xCallableObject)
389
+        foreach ($this->aCallableObjects as $sClassName => $xCallableObject)
390 390
         {
391 391
             $sHash .= $sClassName . implode('|', $xCallableObject->getMethods());
392 392
         }
@@ -407,16 +407,16 @@  discard block
 block discarded – undo
407 407
 
408 408
         $aJsClasses = [];
409 409
         $sCode = '';
410
-        foreach(array_keys($this->aNamespaces) as $sNamespace)
410
+        foreach (array_keys($this->aNamespaces) as $sNamespace)
411 411
         {
412 412
             $offset = 0;
413 413
             $sJsNamespace = str_replace('\\', '.', $sNamespace);
414 414
             $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop.
415
-            while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
415
+            while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false)
416 416
             {
417 417
                 $sJsClass = substr($sJsNamespace, 0, $dotPosition);
418 418
                 // Generate code for this object
419
-                if(!key_exists($sJsClass, $aJsClasses))
419
+                if (!key_exists($sJsClass, $aJsClasses))
420 420
                 {
421 421
                     $sCode .= "$sPrefix$sJsClass = {};\n";
422 422
                     $aJsClasses[$sJsClass] = $sJsClass;
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
             }
426 426
         }
427 427
 
428
-        foreach($this->aCallableObjects as $sClassName => $xCallableObject)
428
+        foreach ($this->aCallableObjects as $sClassName => $xCallableObject)
429 429
         {
430 430
             $aConfig = $this->aCallableOptions[$sClassName];
431 431
             $aCommonConfig = key_exists('*', $aConfig) ? $aConfig['*'] : [];
432 432
 
433 433
             $aMethods = [];
434
-            foreach($xCallableObject->getMethods() as $sMethodName)
434
+            foreach ($xCallableObject->getMethods() as $sMethodName)
435 435
             {
436 436
                 // Specific options for this method
437 437
                 $aMethodConfig = key_exists($sMethodName, $aConfig) ?
Please login to merge, or discard this patch.
src/Request/Plugin/CallableDir.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
         }
165 165
         else
166 166
         {
167
-             // Use underscore as separator, so there's no need to deal with namespace
167
+                // Use underscore as separator, so there's no need to deal with namespace
168 168
             // when generating javascript code.
169 169
             $aOptions['separator'] = '_';
170 170
             $aOptions['autoload'] = $this->bAutoloadEnabled;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -161,8 +161,7 @@
 block discarded – undo
161 161
             }
162 162
 
163 163
             $this->xRepository->addNamespace($sNamespace, $aOptions);
164
-        }
165
-        else
164
+        } else
166 165
         {
167 166
              // Use underscore as separator, so there's no need to deal with namespace
168 167
             // when generating javascript code.
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -105,33 +105,33 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function register($sType, $sDirectory, $aOptions)
107 107
     {
108
-        if($sType != $this->getName())
108
+        if ($sType != $this->getName())
109 109
         {
110 110
             return false;
111 111
         }
112 112
 
113
-        if(!is_string($sDirectory) || !is_dir($sDirectory))
113
+        if (!is_string($sDirectory) || !is_dir($sDirectory))
114 114
         {
115 115
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
116 116
         }
117
-        if(is_string($aOptions))
117
+        if (is_string($aOptions))
118 118
         {
119 119
             $aOptions = ['namespace' => $aOptions];
120 120
         }
121
-        if(!is_array($aOptions))
121
+        if (!is_array($aOptions))
122 122
         {
123 123
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
124 124
         }
125 125
 
126 126
         $sDirectory = rtrim(trim($sDirectory), DIRECTORY_SEPARATOR);
127
-        if(!is_dir($sDirectory))
127
+        if (!is_dir($sDirectory))
128 128
         {
129 129
             return false;
130 130
         }
131 131
         $aOptions['directory'] = realpath($sDirectory);
132 132
 
133 133
         $sNamespace = key_exists('namespace', $aOptions) ? $aOptions['namespace'] : '';
134
-        if(!($sNamespace = trim($sNamespace, ' \\')))
134
+        if (!($sNamespace = trim($sNamespace, ' \\')))
135 135
         {
136 136
             $sNamespace = '';
137 137
         }
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 
146 146
         // Change the keys in $aOptions to have "\" as separator
147 147
         $_aOptions = [];
148
-        foreach($aOptions as $sName => $aOption)
148
+        foreach ($aOptions as $sName => $aOption)
149 149
         {
150 150
             $sName = trim(str_replace('.', '\\', $sName), ' \\');
151 151
             $_aOptions[$sName] = $aOption;
152 152
         }
153 153
         $aOptions = $_aOptions;
154 154
 
155
-        if(($sNamespace))
155
+        if (($sNamespace))
156 156
         {
157 157
             // Register the dir with PSR4 autoloading
158
-            if(($this->xAutoloader))
158
+            if (($this->xAutoloader))
159 159
             {
160 160
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
161 161
             }
Please login to merge, or discard this patch.
src/Factory/Request.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
         $this->sPrefix = $this->getOption('core.prefix.function');
62 62
 
63 63
         $sClass = trim($sClass, '.\\ ');
64
-        if(!$sClass)
64
+        if (!$sClass)
65 65
         {
66 66
             return $this;
67 67
         }
68 68
 
69
-        if(!($xCallable = $this->xRepository->getCallableObject($sClass)))
69
+        if (!($xCallable = $this->xRepository->getCallableObject($sClass)))
70 70
         {
71 71
             // Todo: decide which of these values to return
72 72
             // return null;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         array_shift($aArguments);
108 108
 
109 109
         // Makes legacy code works
110
-        if(strpos($sFunction, '.') !== false)
110
+        if (strpos($sFunction, '.') !== false)
111 111
         {
112 112
             // If there is a dot in the name, then it is a call to a class
113 113
             $this->sPrefix = $this->getOption('core.prefix.class');
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param string|null            $sClass              The callable class
56 56
      *
57
-     * @return Factory
57
+     * @return Request
58 58
      */
59 59
     public function setClassName($sClass)
60 60
     {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @param CallableObject          $xCallable              The callable object
84 84
      *
85
-     * @return Factory
85
+     * @return Request
86 86
      */
87 87
     public function setCallable(CallableObject $xCallable)
88 88
     {
@@ -95,7 +95,6 @@  discard block
 block discarded – undo
95 95
      * Return the javascript call to a Jaxon function or object method
96 96
      *
97 97
      * @param string            $sFunction          The function or method (without class) name
98
-     * @param ...               $xParams            The parameters of the function or method
99 98
      *
100 99
      * @return \Jaxon\Request\Request
101 100
      */
@@ -124,7 +123,6 @@  discard block
 block discarded – undo
124 123
      * Return the javascript call to a generic function
125 124
      *
126 125
      * @param string            $sFunction          The function or method (with class) name
127
-     * @param ...               $xParams            The parameters of the function or method
128 126
      *
129 127
      * @return \Jaxon\Request\Request
130 128
      */
Please login to merge, or discard this patch.
src/Utils/Pagination/Renderer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function getPrevLink()
65 65
     {
66
-        if(!($sCall = $this->xPaginator->getPrevCall()))
66
+        if (!($sCall = $this->xPaginator->getPrevCall()))
67 67
         {
68 68
             return '';
69 69
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     protected function getNextLink()
80 80
     {
81
-        if(!($sCall = $this->xPaginator->getNextCall()))
81
+        if (!($sCall = $this->xPaginator->getNextCall()))
82 82
         {
83 83
             return '';
84 84
         }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
     protected function getLinks()
95 95
     {
96 96
         $sLinks = '';
97
-        foreach($this->xPaginator->getPages() as $page)
97
+        foreach ($this->xPaginator->getPages() as $page)
98 98
         {
99
-            if($page['call'])
99
+            if ($page['call'])
100 100
             {
101 101
                 $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled');
102 102
                 $sLinks .= $this->xTemplate->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,8 +100,7 @@
 block discarded – undo
100 100
             {
101 101
                 $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled');
102 102
                 $sLinks .= $this->xTemplate->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]);
103
-            }
104
-            else
103
+            } else
105 104
             {
106 105
                 $sLinks .= $this->xTemplate->render('pagination::links/disabled', ['text' => $page['num']]);
107 106
             }
Please login to merge, or discard this patch.
src/Request/Support/UserFunction.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function configure($sName, $sValue)
86 86
     {
87
-        switch($sName)
87
+        switch ($sName)
88 88
         {
89 89
         case 'class': // The user function is a method in the given class
90 90
             $this->xUserFunction = [$sValue, $this->xUserFunction];
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function call($aArgs = [])
141 141
     {
142
-        if(($this->sInclude))
142
+        if (($this->sInclude))
143 143
         {
144 144
             require_once $this->sInclude;
145 145
         }
146 146
 
147 147
         // If the function is an alias for a class method, then instanciate the class
148
-        if(is_array($this->xUserFunction) && is_string($this->xUserFunction[0]))
148
+        if (is_array($this->xUserFunction) && is_string($this->xUserFunction[0]))
149 149
         {
150 150
             $sClassName = $this->xUserFunction[0];
151 151
             $this->xUserFunction[0] = new $sClassName;
Please login to merge, or discard this patch.