@@ -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 |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - jaxon()->di()->set($sUserFunction, function () use ($sCallableObject, $aOptions) { |
|
| 209 | + jaxon()->di()->set($sUserFunction, function() use ($sCallableObject, $aOptions) { |
|
| 210 | 210 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($sCallableObject); |
| 211 | 211 | |
| 212 | - foreach($aOptions as $sMethod => $aValue) |
|
| 212 | + foreach ($aOptions as $sMethod => $aValue) |
|
| 213 | 213 | { |
| 214 | - foreach($aValue as $sName => $sValue) |
|
| 214 | + foreach ($aValue as $sName => $sValue) |
|
| 215 | 215 | { |
| 216 | 216 | $xCallableObject->configure($sMethod, $sName, $sValue); |
| 217 | 217 | } |
@@ -235,37 +235,37 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = []) |
| 237 | 237 | { |
| 238 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 238 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 239 | 239 | { |
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
| 243 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
| 243 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
| 244 | 244 | { |
| 245 | 245 | $sSeparator = '.'; |
| 246 | 246 | } |
| 247 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 247 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 248 | 248 | { |
| 249 | 249 | $sNamespace = ''; |
| 250 | 250 | } |
| 251 | - if(($sNamespace)) |
|
| 251 | + if (($sNamespace)) |
|
| 252 | 252 | { |
| 253 | 253 | // If there is an autoloader, register the dir with PSR4 autoloading |
| 254 | - if(($this->xAutoloader)) |
|
| 254 | + if (($this->xAutoloader)) |
|
| 255 | 255 | { |
| 256 | 256 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | - elseif(($this->xAutoloader)) |
|
| 259 | + elseif (($this->xAutoloader)) |
|
| 260 | 260 | { |
| 261 | 261 | // If there is an autoloader, register the dir with classmap autoloading |
| 262 | 262 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 263 | 263 | $itFile = new RecursiveIteratorIterator($itDir); |
| 264 | 264 | // Iterate on dir content |
| 265 | - foreach($itFile as $xFile) |
|
| 265 | + foreach ($itFile as $xFile) |
|
| 266 | 266 | { |
| 267 | 267 | // skip everything except PHP files |
| 268 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 268 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 269 | 269 | { |
| 270 | 270 | continue; |
| 271 | 271 | } |
@@ -301,33 +301,33 @@ discard block |
||
| 301 | 301 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 302 | 302 | $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS)); |
| 303 | 303 | $sClassName = $xFile->getBasename('.php'); |
| 304 | - if(($sNamespace)) |
|
| 304 | + if (($sNamespace)) |
|
| 305 | 305 | { |
| 306 | 306 | $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace; |
| 307 | 307 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
| 308 | 308 | } |
| 309 | 309 | // Require the file only if autoload is enabled but there is no autoloader |
| 310 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 310 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 311 | 311 | { |
| 312 | 312 | require_once($xFile->getPathname()); |
| 313 | 313 | } |
| 314 | 314 | // Create and register an instance of the class |
| 315 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 315 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 316 | 316 | { |
| 317 | 317 | $aOptions['*'] = []; |
| 318 | 318 | } |
| 319 | 319 | $aOptions['*']['separator'] = $sSeparator; |
| 320 | - if(($sNamespace)) |
|
| 320 | + if (($sNamespace)) |
|
| 321 | 321 | { |
| 322 | 322 | $aOptions['*']['namespace'] = $sNamespace; |
| 323 | 323 | } |
| 324 | - if(($sClassPath)) |
|
| 324 | + if (($sClassPath)) |
|
| 325 | 325 | { |
| 326 | 326 | $aOptions['*']['classpath'] = $sClassPath; |
| 327 | 327 | } |
| 328 | 328 | // Filter excluded methods |
| 329 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
| 330 | - if(count($aProtected) > 0) |
|
| 329 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
| 330 | + if (count($aProtected) > 0) |
|
| 331 | 331 | { |
| 332 | 332 | $aOptions['*']['protected'] = $aProtected; |
| 333 | 333 | } |
@@ -346,13 +346,13 @@ discard block |
||
| 346 | 346 | $sDS = DIRECTORY_SEPARATOR; |
| 347 | 347 | // Change the keys in $aOptions to have "\" as separator |
| 348 | 348 | $aNewOptions = []; |
| 349 | - foreach($aOptions as $key => $aOption) |
|
| 349 | + foreach ($aOptions as $key => $aOption) |
|
| 350 | 350 | { |
| 351 | 351 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
| 352 | 352 | $aNewOptions[$key] = $aOption; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - foreach($this->aClassDirs as $aClassDir) |
|
| 355 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 356 | 356 | { |
| 357 | 357 | // Get the directory |
| 358 | 358 | $sDirectory = $aClassDir['directory']; |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 363 | 363 | $itFile = new RecursiveIteratorIterator($itDir); |
| 364 | 364 | // Iterate on dir content |
| 365 | - foreach($itFile as $xFile) |
|
| 365 | + foreach ($itFile as $xFile) |
|
| 366 | 366 | { |
| 367 | 367 | // skip everything except PHP files |
| 368 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 368 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 369 | 369 | { |
| 370 | 370 | continue; |
| 371 | 371 | } |
@@ -374,17 +374,17 @@ discard block |
||
| 374 | 374 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 375 | 375 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
| 376 | 376 | $sClassName = $xFile->getBasename('.php'); |
| 377 | - if(($sClassPath)) |
|
| 377 | + if (($sClassPath)) |
|
| 378 | 378 | { |
| 379 | 379 | $sClassName = $sClassPath . '\\' . $sClassName; |
| 380 | 380 | } |
| 381 | - if(($sNamespace)) |
|
| 381 | + if (($sNamespace)) |
|
| 382 | 382 | { |
| 383 | 383 | $sClassName = $sNamespace . '\\' . $sClassName; |
| 384 | 384 | } |
| 385 | 385 | // Get the class options |
| 386 | 386 | $aClassOptions = []; |
| 387 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
| 387 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
| 388 | 388 | { |
| 389 | 389 | $aClassOptions = $aNewOptions[$sClassName]; |
| 390 | 390 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function registerClass($sClassName, array $aOptions = []) |
| 407 | 407 | { |
| 408 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
| 408 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
| 409 | 409 | { |
| 410 | 410 | return false; |
| 411 | 411 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | // Replace "." and "_" with antislashes, and set the class path. |
| 415 | 415 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
| 416 | 416 | $sClassPath = ''; |
| 417 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 417 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 418 | 418 | { |
| 419 | 419 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
| 420 | 420 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
| 424 | 424 | |
| 425 | 425 | // Search for the class file in all directories. |
| 426 | - foreach($this->aClassDirs as $aClassDir) |
|
| 426 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 427 | 427 | { |
| 428 | 428 | // Get the separator |
| 429 | 429 | $sSeparator = $aClassDir['separator']; |
@@ -432,15 +432,15 @@ discard block |
||
| 432 | 432 | $nLen = strlen($sNamespace); |
| 433 | 433 | $sFullPath = ''; |
| 434 | 434 | // Check if the class belongs to the namespace |
| 435 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 435 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 436 | 436 | { |
| 437 | 437 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
| 438 | 438 | } |
| 439 | - elseif(!($sNamespace)) |
|
| 439 | + elseif (!($sNamespace)) |
|
| 440 | 440 | { |
| 441 | 441 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
| 442 | 442 | } |
| 443 | - if(($sFullPath) && is_file($sFullPath)) |
|
| 443 | + if (($sFullPath) && is_file($sFullPath)) |
|
| 444 | 444 | { |
| 445 | 445 | // Found the file in this directory |
| 446 | 446 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | { |
| 463 | 463 | $di = jaxon()->di(); |
| 464 | 464 | $sHash = ''; |
| 465 | - foreach($this->aCallableObjects as $sName) |
|
| 465 | + foreach ($this->aCallableObjects as $sName) |
|
| 466 | 466 | { |
| 467 | 467 | $xCallableObject = $di->get($sName); |
| 468 | 468 | $sHash .= $sName . implode('|', $xCallableObject->getMethods()); |
@@ -481,15 +481,15 @@ discard block |
||
| 481 | 481 | // Generate code for javascript objects declaration |
| 482 | 482 | $code = ''; |
| 483 | 483 | $classes = []; |
| 484 | - foreach($this->aClassPaths as $sClassPath) |
|
| 484 | + foreach ($this->aClassPaths as $sClassPath) |
|
| 485 | 485 | { |
| 486 | 486 | $offset = 0; |
| 487 | 487 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
| 488 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 488 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 489 | 489 | { |
| 490 | 490 | $class = substr($sClassPath, 0, $dotPosition); |
| 491 | 491 | // Generate code for this object |
| 492 | - if(!array_key_exists($class, $classes)) |
|
| 492 | + if (!array_key_exists($class, $classes)) |
|
| 493 | 493 | { |
| 494 | 494 | $code .= "$sJaxonPrefix$class = {};\n"; |
| 495 | 495 | $classes[$class] = $class; |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | } |
| 500 | 500 | // Generate code for javascript methods |
| 501 | 501 | $di = jaxon()->di(); |
| 502 | - foreach($this->aCallableObjects as $sName) |
|
| 502 | + foreach ($this->aCallableObjects as $sName) |
|
| 503 | 503 | { |
| 504 | 504 | $xCallableObject = $di->get($sName); |
| 505 | 505 | $code .= $xCallableObject->getScript(); |
@@ -515,13 +515,13 @@ discard block |
||
| 515 | 515 | public function canProcessRequest() |
| 516 | 516 | { |
| 517 | 517 | // Check the validity of the class name |
| 518 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 518 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 519 | 519 | { |
| 520 | 520 | $this->sRequestedClass = null; |
| 521 | 521 | $this->sRequestedMethod = null; |
| 522 | 522 | } |
| 523 | 523 | // Check the validity of the method name |
| 524 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 524 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 525 | 525 | { |
| 526 | 526 | $this->sRequestedClass = null; |
| 527 | 527 | $this->sRequestedMethod = null; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | */ |
| 537 | 537 | public function processRequest() |
| 538 | 538 | { |
| 539 | - if(!$this->canProcessRequest()) |
|
| 539 | + if (!$this->canProcessRequest()) |
|
| 540 | 540 | { |
| 541 | 541 | return false; |
| 542 | 542 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | // Find the requested method |
| 547 | 547 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
| 548 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 548 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 549 | 549 | { |
| 550 | 550 | // Unable to find the requested object or method |
| 551 | 551 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | // at the beginning and the end of the class name. |
| 571 | 571 | $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\'); |
| 572 | 572 | // Register an instance of the requested class, if it isn't yet |
| 573 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
| 573 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
| 574 | 574 | { |
| 575 | 575 | $this->getPluginManager()->registerClass($sClassName); |
| 576 | 576 | } |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $this->sRequestedFunction = null; |
| 53 | 53 | |
| 54 | - if(isset($_GET['jxnfun'])) |
|
| 54 | + if (isset($_GET['jxnfun'])) |
|
| 55 | 55 | { |
| 56 | 56 | $this->sRequestedFunction = $_GET['jxnfun']; |
| 57 | 57 | } |
| 58 | - if(isset($_POST['jxnfun'])) |
|
| 58 | + if (isset($_POST['jxnfun'])) |
|
| 59 | 59 | { |
| 60 | 60 | $this->sRequestedFunction = $_POST['jxnfun']; |
| 61 | 61 | } |
@@ -80,49 +80,49 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function register($aArgs) |
| 82 | 82 | { |
| 83 | - if(count($aArgs) < 2) |
|
| 83 | + if (count($aArgs) < 2) |
|
| 84 | 84 | { |
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $sType = $aArgs[0]; |
| 89 | - if($sType != Jaxon::USER_FUNCTION) |
|
| 89 | + if ($sType != Jaxon::USER_FUNCTION) |
|
| 90 | 90 | { |
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $sUserFunction = $aArgs[1]; |
| 95 | - if(!is_string($sUserFunction)) |
|
| 95 | + if (!is_string($sUserFunction)) |
|
| 96 | 96 | { |
| 97 | 97 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 98 | 98 | } |
| 99 | 99 | $this->aFunctions[] = $sUserFunction; |
| 100 | 100 | |
| 101 | 101 | $aOptions = count($aArgs) > 2 ? $aArgs[2] : []; |
| 102 | - if(is_string($aOptions)) |
|
| 102 | + if (is_string($aOptions)) |
|
| 103 | 103 | { |
| 104 | 104 | $aOptions = ['include' => $aOptions]; |
| 105 | 105 | } |
| 106 | - if(!is_array($aOptions)) |
|
| 106 | + if (!is_array($aOptions)) |
|
| 107 | 107 | { |
| 108 | 108 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Check if an alias is defined |
| 112 | 112 | $sFunctionName = $sUserFunction; |
| 113 | - foreach($aOptions as $sName => $sValue) |
|
| 113 | + foreach ($aOptions as $sName => $sValue) |
|
| 114 | 114 | { |
| 115 | - if($sName == 'alias') |
|
| 115 | + if ($sName == 'alias') |
|
| 116 | 116 | { |
| 117 | 117 | $sFunctionName = $sValue; |
| 118 | 118 | break; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - jaxon()->di()->set($sFunctionName, function () use ($sUserFunction, $aOptions) { |
|
| 122 | + jaxon()->di()->set($sFunctionName, function() use ($sUserFunction, $aOptions) { |
|
| 123 | 123 | $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction); |
| 124 | 124 | |
| 125 | - foreach($aOptions as $sName => $sValue) |
|
| 125 | + foreach ($aOptions as $sName => $sValue) |
|
| 126 | 126 | { |
| 127 | 127 | $xUserFunction->configure($sName, $sValue); |
| 128 | 128 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $di = jaxon()->di(); |
| 154 | 154 | $code = ''; |
| 155 | - foreach($this->aFunctions as $sName) |
|
| 155 | + foreach ($this->aFunctions as $sName) |
|
| 156 | 156 | { |
| 157 | 157 | $xFunction = $di->get($sName); |
| 158 | 158 | $code .= $xFunction->getScript(); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | public function canProcessRequest() |
| 169 | 169 | { |
| 170 | 170 | // Check the validity of the function name |
| 171 | - if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 171 | + if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 172 | 172 | { |
| 173 | 173 | $this->sRequestedFunction = null; |
| 174 | 174 | } |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function processRequest() |
| 184 | 184 | { |
| 185 | - if(!$this->canProcessRequest()) |
|
| 185 | + if (!$this->canProcessRequest()) |
|
| 186 | 186 | { |
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if(!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 190 | + if (!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 191 | 191 | { |
| 192 | 192 | // Unable to find the requested function |
| 193 | 193 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid', |