@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param string|null $sClass The callable class |
36 | 36 | * |
37 | - * @return Factory |
|
37 | + * @return Request |
|
38 | 38 | */ |
39 | 39 | public function setClassName($sClass) |
40 | 40 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param CallableObject $xCallable The callable object |
59 | 59 | * |
60 | - * @return Factory |
|
60 | + * @return Request |
|
61 | 61 | */ |
62 | 62 | public function setCallable(CallableObject $xCallable) |
63 | 63 | { |
@@ -70,9 +70,8 @@ discard block |
||
70 | 70 | * Return the javascript call to a Jaxon function or object method |
71 | 71 | * |
72 | 72 | * @param string $sFunction The function or method (without class) name |
73 | - * @param ... $xParams The parameters of the function or method |
|
74 | 73 | * |
75 | - * @return \Jaxon\Request\Request |
|
74 | + * @return Request |
|
76 | 75 | */ |
77 | 76 | public function call($sFunction) |
78 | 77 | { |
@@ -99,9 +98,8 @@ discard block |
||
99 | 98 | * Return the javascript call to a generic function |
100 | 99 | * |
101 | 100 | * @param string $sFunction The function or method (with class) name |
102 | - * @param ... $xParams The parameters of the function or method |
|
103 | 101 | * |
104 | - * @return \Jaxon\Request\Request |
|
102 | + * @return Request |
|
105 | 103 | */ |
106 | 104 | public function func($sFunction) |
107 | 105 | { |
@@ -123,7 +121,6 @@ discard block |
||
123 | 121 | * @param integer $nItemsPerPage The number of items per page page |
124 | 122 | * @param integer $nCurrentPage The current page |
125 | 123 | * @param string $sMethod The name of function or a method prepended with its class name |
126 | - * @param ... $xParams The parameters of the function or method |
|
127 | 124 | * |
128 | 125 | * @return string the pagination links |
129 | 126 | */ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function getInstance() |
32 | 32 | { |
33 | - if(!self::$xInstance) |
|
33 | + if (!self::$xInstance) |
|
34 | 34 | { |
35 | 35 | self::$xInstance = new Container(); |
36 | 36 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | * Managers |
91 | 91 | */ |
92 | 92 | // Plugin Manager |
93 | - $this->coreContainer['jaxon.core.plugin_manager'] = function ($c) { |
|
93 | + $this->coreContainer['jaxon.core.plugin_manager'] = function($c) { |
|
94 | 94 | return new \Jaxon\Plugin\Manager(); |
95 | 95 | }; |
96 | 96 | // Request Manager |
97 | - $this->coreContainer['jaxon.core.request_manager'] = function ($c) { |
|
97 | + $this->coreContainer['jaxon.core.request_manager'] = function($c) { |
|
98 | 98 | return new \Jaxon\Request\Manager(); |
99 | 99 | }; |
100 | 100 | // Request Factory |
101 | - $this->coreContainer['jaxon.core.request_factory'] = function ($c) { |
|
101 | + $this->coreContainer['jaxon.core.request_factory'] = function($c) { |
|
102 | 102 | return new \Jaxon\Factory\Request(); |
103 | 103 | }; |
104 | 104 | // Response Manager |
105 | - $this->coreContainer['jaxon.core.response_manager'] = function ($c) { |
|
105 | + $this->coreContainer['jaxon.core.response_manager'] = function($c) { |
|
106 | 106 | return new \Jaxon\Response\Manager(); |
107 | 107 | }; |
108 | 108 | |
@@ -110,35 +110,35 @@ discard block |
||
110 | 110 | * Services |
111 | 111 | */ |
112 | 112 | // Config manager |
113 | - $this->coreContainer['jaxon.core.config'] = function ($c) { |
|
113 | + $this->coreContainer['jaxon.core.config'] = function($c) { |
|
114 | 114 | return new \Jaxon\Utils\Config\Config(); |
115 | 115 | }; |
116 | 116 | // Minifier |
117 | - $this->coreContainer['jaxon.core.minifier'] = function ($c) { |
|
117 | + $this->coreContainer['jaxon.core.minifier'] = function($c) { |
|
118 | 118 | return new \Jaxon\Utils\Template\Minifier(); |
119 | 119 | }; |
120 | 120 | // Translator |
121 | - $this->coreContainer['jaxon.core.translator'] = function ($c) { |
|
121 | + $this->coreContainer['jaxon.core.translator'] = function($c) { |
|
122 | 122 | return new \Jaxon\Utils\Translation\Translator($c['jaxon.core.translation_dir'], $c['jaxon.core.config']); |
123 | 123 | }; |
124 | 124 | // Template engine |
125 | - $this->coreContainer['jaxon.core.template'] = function ($c) { |
|
125 | + $this->coreContainer['jaxon.core.template'] = function($c) { |
|
126 | 126 | return new \Jaxon\Utils\Template\Template($c['jaxon.core.template_dir']); |
127 | 127 | }; |
128 | 128 | // Validator |
129 | - $this->coreContainer['jaxon.core.validator'] = function ($c) { |
|
129 | + $this->coreContainer['jaxon.core.validator'] = function($c) { |
|
130 | 130 | return new \Jaxon\Utils\Validation\Validator($c['jaxon.core.translator'], $c['jaxon.core.config']); |
131 | 131 | }; |
132 | 132 | // Pagination Renderer |
133 | - $this->coreContainer['jaxon.pagination.renderer'] = function ($c) { |
|
133 | + $this->coreContainer['jaxon.pagination.renderer'] = function($c) { |
|
134 | 134 | return new \Jaxon\Utils\Pagination\Renderer(); |
135 | 135 | }; |
136 | 136 | // Pagination Paginator |
137 | - $this->coreContainer['jaxon.pagination.paginator'] = function ($c) { |
|
137 | + $this->coreContainer['jaxon.pagination.paginator'] = function($c) { |
|
138 | 138 | return new \Jaxon\Utils\Pagination\Paginator($c['jaxon.pagination.renderer']); |
139 | 139 | }; |
140 | 140 | // Event Dispatcher |
141 | - $this->coreContainer['jaxon.core.events'] = function ($c) { |
|
141 | + $this->coreContainer['jaxon.core.events'] = function($c) { |
|
142 | 142 | return new EventDispatcher(); |
143 | 143 | }; |
144 | 144 | |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | * Core library objects |
147 | 147 | */ |
148 | 148 | // Global Response |
149 | - $this->coreContainer['jaxon.core.response'] = function ($c) { |
|
149 | + $this->coreContainer['jaxon.core.response'] = function($c) { |
|
150 | 150 | return new \Jaxon\Response\Response(); |
151 | 151 | }; |
152 | 152 | // Jaxon Core |
153 | - $this->coreContainer['jaxon.core.jaxon'] = function ($c) { |
|
153 | + $this->coreContainer['jaxon.core.jaxon'] = function($c) { |
|
154 | 154 | return new \Jaxon\Jaxon(); |
155 | 155 | }; |
156 | 156 | // View Renderer Facade |
157 | - $this->coreContainer['jaxon.sentry.view.renderer'] = function ($c) { |
|
157 | + $this->coreContainer['jaxon.sentry.view.renderer'] = function($c) { |
|
158 | 158 | $aRenderers = $c['jaxon.view.data.renderers']; |
159 | 159 | $sDefaultNamespace = $c['jaxon.view.data.namespace.default']; |
160 | 160 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function get($sClass) |
170 | 170 | { |
171 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
171 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
172 | 172 | { |
173 | 173 | return $this->sentryContainer->get($sClass); |
174 | 174 | } |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
444 | 444 | |
445 | 445 | // Return the initialized view renderer |
446 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
446 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
447 | 447 | // Get the defined renderer |
448 | 448 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
449 | 449 | // Init the renderer with the template namespaces |
450 | 450 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
451 | - if(key_exists($sId, $aNamespaces)) |
|
451 | + if (key_exists($sId, $aNamespaces)) |
|
452 | 452 | { |
453 | - foreach($aNamespaces[$sId] as $ns) |
|
453 | + foreach ($aNamespaces[$sId] as $ns) |
|
454 | 454 | { |
455 | 455 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
456 | 456 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function getViewRenderer($sId = '') |
470 | 470 | { |
471 | - if(!$sId) |
|
471 | + if (!$sId) |
|
472 | 472 | { |
473 | 473 | // Return the view renderer facade |
474 | 474 | return $this->coreContainer['jaxon.sentry.view.renderer']; |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | $this->sRequestedClass = null; |
92 | 92 | $this->sRequestedMethod = null; |
93 | 93 | |
94 | - if(!empty($_GET['jxncls'])) |
|
94 | + if (!empty($_GET['jxncls'])) |
|
95 | 95 | { |
96 | 96 | $this->sRequestedClass = $_GET['jxncls']; |
97 | 97 | } |
98 | - if(!empty($_GET['jxnmthd'])) |
|
98 | + if (!empty($_GET['jxnmthd'])) |
|
99 | 99 | { |
100 | 100 | $this->sRequestedMethod = $_GET['jxnmthd']; |
101 | 101 | } |
102 | - if(!empty($_POST['jxncls'])) |
|
102 | + if (!empty($_POST['jxncls'])) |
|
103 | 103 | { |
104 | 104 | $this->sRequestedClass = $_POST['jxncls']; |
105 | 105 | } |
106 | - if(!empty($_POST['jxnmthd'])) |
|
106 | + if (!empty($_POST['jxnmthd'])) |
|
107 | 107 | { |
108 | 108 | $this->sRequestedMethod = $_POST['jxnmthd']; |
109 | 109 | } |
@@ -152,19 +152,19 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function register($aArgs) |
154 | 154 | { |
155 | - if(count($aArgs) < 2) |
|
155 | + if (count($aArgs) < 2) |
|
156 | 156 | { |
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $sType = $aArgs[0]; |
161 | - if($sType != Jaxon::CALLABLE_OBJECT) |
|
161 | + if ($sType != Jaxon::CALLABLE_OBJECT) |
|
162 | 162 | { |
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $sCallableObject = $aArgs[1]; |
167 | - if(!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
167 | + if (!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
168 | 168 | { |
169 | 169 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
170 | 170 | } |
@@ -172,31 +172,31 @@ discard block |
||
172 | 172 | $this->aCallableObjects[] = $sCallableObject; |
173 | 173 | |
174 | 174 | $aOptions = count($aArgs) > 2 ? $aArgs[2] : []; |
175 | - if(is_string($aOptions)) |
|
175 | + if (is_string($aOptions)) |
|
176 | 176 | { |
177 | 177 | $aOptions = ['namespace' => $aOptions]; |
178 | 178 | } |
179 | - if(!is_array($aOptions)) |
|
179 | + if (!is_array($aOptions)) |
|
180 | 180 | { |
181 | 181 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
182 | 182 | } |
183 | 183 | |
184 | 184 | // Save the classpath and the separator in this class |
185 | - if(key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
185 | + if (key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
186 | 186 | { |
187 | 187 | $_aOptions = $aOptions['*']; |
188 | 188 | $sSeparator = '.'; |
189 | - if(key_exists('separator', $_aOptions)) |
|
189 | + if (key_exists('separator', $_aOptions)) |
|
190 | 190 | { |
191 | 191 | $sSeparator = trim($_aOptions['separator']); |
192 | 192 | } |
193 | - if(!in_array($sSeparator, ['.', '_'])) |
|
193 | + if (!in_array($sSeparator, ['.', '_'])) |
|
194 | 194 | { |
195 | 195 | $sSeparator = '.'; |
196 | 196 | } |
197 | 197 | $_aOptions['separator'] = $sSeparator; |
198 | 198 | |
199 | - if(array_key_exists('classpath', $_aOptions)) |
|
199 | + if (array_key_exists('classpath', $_aOptions)) |
|
200 | 200 | { |
201 | 201 | $_aOptions['classpath'] = trim($_aOptions['classpath'], ' \\._'); |
202 | 202 | // Save classpath with "\" in the parameters |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | // Register the callable object |
210 | - jaxon()->di()->set($sCallableObject, function () use ($sCallableObject, $aOptions) { |
|
210 | + jaxon()->di()->set($sCallableObject, function() use ($sCallableObject, $aOptions) { |
|
211 | 211 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($sCallableObject); |
212 | 212 | |
213 | - foreach($aOptions as $sMethod => $aValue) |
|
213 | + foreach ($aOptions as $sMethod => $aValue) |
|
214 | 214 | { |
215 | - foreach($aValue as $sName => $sValue) |
|
215 | + foreach ($aValue as $sName => $sValue) |
|
216 | 216 | { |
217 | 217 | $xCallableObject->configure($sMethod, $sName, $sValue); |
218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | }); |
223 | 223 | |
224 | 224 | // Register the request factory for this callable object |
225 | - jaxon()->di()->set($sCallableObject . '\Factory\Rq', function ($di) use ($sCallableObject) { |
|
225 | + jaxon()->di()->set($sCallableObject . '\Factory\Rq', function($di) use ($sCallableObject) { |
|
226 | 226 | $xCallableObject = $di->get($sCallableObject); |
227 | 227 | return new \Jaxon\Factory\Request\Portable($xCallableObject); |
228 | 228 | }); |
229 | 229 | |
230 | 230 | // Register the paginator factory for this callable object |
231 | - jaxon()->di()->set($sCallableObject . '\Factory\Pg', function ($di) use ($sCallableObject) { |
|
231 | + jaxon()->di()->set($sCallableObject . '\Factory\Pg', function($di) use ($sCallableObject) { |
|
232 | 232 | $xCallableObject = $di->get($sCallableObject); |
233 | 233 | return new \Jaxon\Factory\Request\Paginator($xCallableObject); |
234 | 234 | }); |
@@ -248,37 +248,37 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = []) |
250 | 250 | { |
251 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
251 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
252 | 252 | { |
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
256 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
256 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
257 | 257 | { |
258 | 258 | $sSeparator = '.'; |
259 | 259 | } |
260 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
260 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
261 | 261 | { |
262 | 262 | $sNamespace = ''; |
263 | 263 | } |
264 | - if(($sNamespace)) |
|
264 | + if (($sNamespace)) |
|
265 | 265 | { |
266 | 266 | // If there is an autoloader, register the dir with PSR4 autoloading |
267 | - if(($this->xAutoloader)) |
|
267 | + if (($this->xAutoloader)) |
|
268 | 268 | { |
269 | 269 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
270 | 270 | } |
271 | 271 | } |
272 | - elseif(($this->xAutoloader)) |
|
272 | + elseif (($this->xAutoloader)) |
|
273 | 273 | { |
274 | 274 | // If there is an autoloader, register the dir with classmap autoloading |
275 | 275 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
276 | 276 | $itFile = new RecursiveIteratorIterator($itDir); |
277 | 277 | // Iterate on dir content |
278 | - foreach($itFile as $xFile) |
|
278 | + foreach ($itFile as $xFile) |
|
279 | 279 | { |
280 | 280 | // skip everything except PHP files |
281 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
281 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
282 | 282 | { |
283 | 283 | continue; |
284 | 284 | } |
@@ -314,33 +314,33 @@ discard block |
||
314 | 314 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
315 | 315 | $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS)); |
316 | 316 | $sClassName = $xFile->getBasename('.php'); |
317 | - if(($sNamespace)) |
|
317 | + if (($sNamespace)) |
|
318 | 318 | { |
319 | 319 | $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace; |
320 | 320 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
321 | 321 | } |
322 | 322 | // Require the file only if autoload is enabled but there is no autoloader |
323 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
323 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
324 | 324 | { |
325 | 325 | require_once($xFile->getPathname()); |
326 | 326 | } |
327 | 327 | // Create and register an instance of the class |
328 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
328 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
329 | 329 | { |
330 | 330 | $aOptions['*'] = []; |
331 | 331 | } |
332 | 332 | $aOptions['*']['separator'] = $sSeparator; |
333 | - if(($sNamespace)) |
|
333 | + if (($sNamespace)) |
|
334 | 334 | { |
335 | 335 | $aOptions['*']['namespace'] = $sNamespace; |
336 | 336 | } |
337 | - if(($sClassPath)) |
|
337 | + if (($sClassPath)) |
|
338 | 338 | { |
339 | 339 | $aOptions['*']['classpath'] = $sClassPath; |
340 | 340 | } |
341 | 341 | // Filter excluded methods |
342 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
343 | - if(count($aProtected) > 0) |
|
342 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
343 | + if (count($aProtected) > 0) |
|
344 | 344 | { |
345 | 345 | $aOptions['*']['protected'] = $aProtected; |
346 | 346 | } |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | $sDS = DIRECTORY_SEPARATOR; |
360 | 360 | // Change the keys in $aOptions to have "\" as separator |
361 | 361 | $aNewOptions = []; |
362 | - foreach($aOptions as $key => $aOption) |
|
362 | + foreach ($aOptions as $key => $aOption) |
|
363 | 363 | { |
364 | 364 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
365 | 365 | $aNewOptions[$key] = $aOption; |
366 | 366 | } |
367 | 367 | |
368 | - foreach($this->aClassDirs as $aClassDir) |
|
368 | + foreach ($this->aClassDirs as $aClassDir) |
|
369 | 369 | { |
370 | 370 | // Get the directory |
371 | 371 | $sDirectory = $aClassDir['directory']; |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
376 | 376 | $itFile = new RecursiveIteratorIterator($itDir); |
377 | 377 | // Iterate on dir content |
378 | - foreach($itFile as $xFile) |
|
378 | + foreach ($itFile as $xFile) |
|
379 | 379 | { |
380 | 380 | // skip everything except PHP files |
381 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
381 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
382 | 382 | { |
383 | 383 | continue; |
384 | 384 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
388 | 388 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
389 | 389 | $sClassName = $xFile->getBasename('.php'); |
390 | - if(($sClassPath)) |
|
390 | + if (($sClassPath)) |
|
391 | 391 | { |
392 | 392 | $sClassName = $sClassPath . '\\' . $sClassName; |
393 | 393 | } |
394 | - if(($sNamespace)) |
|
394 | + if (($sNamespace)) |
|
395 | 395 | { |
396 | 396 | $sClassName = $sNamespace . '\\' . $sClassName; |
397 | 397 | } |
398 | 398 | // Get the class options |
399 | 399 | $aClassOptions = []; |
400 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
400 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
401 | 401 | { |
402 | 402 | $aClassOptions = $aNewOptions[$sClassName]; |
403 | 403 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function registerClass($sClassName, array $aOptions = []) |
420 | 420 | { |
421 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
421 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
422 | 422 | { |
423 | 423 | return false; |
424 | 424 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // Replace "." and "_" with antislashes, and set the class path. |
428 | 428 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
429 | 429 | $sClassPath = ''; |
430 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
430 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
431 | 431 | { |
432 | 432 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
433 | 433 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
437 | 437 | |
438 | 438 | // Search for the class file in all directories. |
439 | - foreach($this->aClassDirs as $aClassDir) |
|
439 | + foreach ($this->aClassDirs as $aClassDir) |
|
440 | 440 | { |
441 | 441 | // Get the separator |
442 | 442 | $sSeparator = $aClassDir['separator']; |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | $nLen = strlen($sNamespace); |
446 | 446 | $sFullPath = ''; |
447 | 447 | // Check if the class belongs to the namespace |
448 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
448 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
449 | 449 | { |
450 | 450 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
451 | 451 | } |
452 | - elseif(!($sNamespace)) |
|
452 | + elseif (!($sNamespace)) |
|
453 | 453 | { |
454 | 454 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
455 | 455 | } |
456 | - if(($sFullPath) && is_file($sFullPath)) |
|
456 | + if (($sFullPath) && is_file($sFullPath)) |
|
457 | 457 | { |
458 | 458 | // Found the file in this directory |
459 | 459 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | { |
476 | 476 | $di = jaxon()->di(); |
477 | 477 | $sHash = ''; |
478 | - foreach($this->aCallableObjects as $sName) |
|
478 | + foreach ($this->aCallableObjects as $sName) |
|
479 | 479 | { |
480 | 480 | $xCallableObject = $di->get($sName); |
481 | 481 | $sHash .= $sName . implode('|', $xCallableObject->getMethods()); |
@@ -494,15 +494,15 @@ discard block |
||
494 | 494 | // Generate code for javascript objects declaration |
495 | 495 | $code = ''; |
496 | 496 | $classes = []; |
497 | - foreach($this->aClassPaths as $sClassPath) |
|
497 | + foreach ($this->aClassPaths as $sClassPath) |
|
498 | 498 | { |
499 | 499 | $offset = 0; |
500 | 500 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
501 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
501 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
502 | 502 | { |
503 | 503 | $class = substr($sClassPath, 0, $dotPosition); |
504 | 504 | // Generate code for this object |
505 | - if(!array_key_exists($class, $classes)) |
|
505 | + if (!array_key_exists($class, $classes)) |
|
506 | 506 | { |
507 | 507 | $code .= "$sJaxonPrefix$class = {};\n"; |
508 | 508 | $classes[$class] = $class; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | } |
513 | 513 | // Generate code for javascript methods |
514 | 514 | $di = jaxon()->di(); |
515 | - foreach($this->aCallableObjects as $sName) |
|
515 | + foreach ($this->aCallableObjects as $sName) |
|
516 | 516 | { |
517 | 517 | $xCallableObject = $di->get($sName); |
518 | 518 | $code .= $xCallableObject->getScript(); |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | public function canProcessRequest() |
529 | 529 | { |
530 | 530 | // Check the validity of the class name |
531 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
531 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
532 | 532 | { |
533 | 533 | $this->sRequestedClass = null; |
534 | 534 | $this->sRequestedMethod = null; |
535 | 535 | } |
536 | 536 | // Check the validity of the method name |
537 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
537 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
538 | 538 | { |
539 | 539 | $this->sRequestedClass = null; |
540 | 540 | $this->sRequestedMethod = null; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function processRequest() |
551 | 551 | { |
552 | - if(!$this->canProcessRequest()) |
|
552 | + if (!$this->canProcessRequest()) |
|
553 | 553 | { |
554 | 554 | return false; |
555 | 555 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | |
559 | 559 | // Find the requested method |
560 | 560 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
561 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
561 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
562 | 562 | { |
563 | 563 | // Unable to find the requested object or method |
564 | 564 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // at the beginning and the end of the class name. |
584 | 584 | $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\'); |
585 | 585 | // Register an instance of the requested class, if it isn't yet |
586 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
586 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
587 | 587 | { |
588 | 588 | $this->getPluginManager()->registerClass($sClassName); |
589 | 589 | } |