@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Setting the route configuration using the configuration file |
|
282 | - * and additional configuration from param |
|
283 | - * @param array $overwriteConfig the additional configuration |
|
284 | - * to overwrite with the existing one |
|
285 | - * @param boolean $useConfigFile whether to use route configuration file |
|
286 | - * |
|
287 | - * @return object |
|
288 | - */ |
|
281 | + * Setting the route configuration using the configuration file |
|
282 | + * and additional configuration from param |
|
283 | + * @param array $overwriteConfig the additional configuration |
|
284 | + * to overwrite with the existing one |
|
285 | + * @param boolean $useConfigFile whether to use route configuration file |
|
286 | + * |
|
287 | + * @return object |
|
288 | + */ |
|
289 | 289 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
290 | 290 | $route = array(); |
291 | 291 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | //the URL like http://domain.com/module/controller/method/arg1/arg2/argn |
367 | 367 | if (!$this->controller && $this->routeMethodMatch /* normally if the route method isnot match no need continue */) { |
368 | 368 | $this->logger->info('Cannot determine the routing information ' |
369 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
369 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
370 | 370 | //determine route parameters using the route URI param |
371 | 371 | $this->determineRouteParamsFromRequestUri(); |
372 | 372 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | //if the request method not match |
397 | 397 | if(!$this->routeMethodMatch){ |
398 | - //create the instance of Controller |
|
398 | + //create the instance of Controller |
|
399 | 399 | $cError = new Controller(); |
400 | 400 | $cError->response->setStatus(405); |
401 | 401 | $cError->response->setFinalPageContent('HTTP method [' . $this->requestMethod . '] not allowed'); |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
496 | - /** |
|
497 | - * Remove the URL suffix and query string values if exists |
|
498 | - * @param string $uri the route URI to process |
|
499 | - * @return string the final route uri after processed |
|
500 | - */ |
|
496 | + /** |
|
497 | + * Remove the URL suffix and query string values if exists |
|
498 | + * @param string $uri the route URI to process |
|
499 | + * @return string the final route uri after processed |
|
500 | + */ |
|
501 | 501 | protected function removeSuffixAndQueryStringFromUri($uri) { |
502 | 502 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
503 | 503 | //remove url suffix from the request URI |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $this->logger->info( |
627 | 627 | 'After loop in predefined routes configuration,' |
628 | 628 | . 'the module name is set but the controller is not set,' |
629 | - . 'so we will use module as the controller' |
|
629 | + . 'so we will use module as the controller' |
|
630 | 630 | ); |
631 | 631 | $this->controller = $this->module; |
632 | 632 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $this->determineRouteParamsInformation(); |
395 | 395 | |
396 | 396 | //if the request method not match |
397 | - if(!$this->routeMethodMatch){ |
|
397 | + if (!$this->routeMethodMatch) { |
|
398 | 398 | //create the instance of Controller |
399 | 399 | $cError = new Controller(); |
400 | 400 | $cError->response->setStatus(405); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
466 | 466 | * @return void |
467 | 467 | */ |
468 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
468 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
469 | 469 | $segment = $this->segments; |
470 | 470 | $globals = & class_loader('GlobalVar', 'classes'); |
471 | 471 | $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos( |
@@ -519,11 +519,11 @@ discard block |
||
519 | 519 | protected function setRouteParamsUsingPredefinedConfig($findIndex) { |
520 | 520 | $callback = $this->callback[$findIndex]; |
521 | 521 | //if callback is array so means user defined the HTTP Method |
522 | - if(is_array($callback) && count($callback) > 0){ |
|
523 | - if(array_key_exists($this->requestMethod, $callback)){ |
|
522 | + if (is_array($callback) && count($callback) > 0) { |
|
523 | + if (array_key_exists($this->requestMethod, $callback)) { |
|
524 | 524 | $callback = $callback[$this->requestMethod]; |
525 | 525 | } |
526 | - else{ |
|
526 | + else { |
|
527 | 527 | //Wrong request method |
528 | 528 | $this->logger->warning('The request method [' . $this->requestMethod . '] is not allowed'); |
529 | 529 | $this->routeMethodMatch = false; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | break; |
610 | 610 | } |
611 | 611 | } |
612 | - if($findIndex !== -1){ |
|
612 | + if ($findIndex !== -1) { |
|
613 | 613 | /* |
614 | 614 | * $args[0] => full string captured by preg_match |
615 | 615 | * $args[1], $args[2], $args[n] => contains the value of |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * Find file path of the current controller using the current module |
637 | 637 | * @return boolean true if the file path is found otherwise false. |
638 | 638 | */ |
639 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
639 | + protected function findControllerFullPathUsingCurrentModule() { |
|
640 | 640 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
641 | 641 | if (!$path) { |
642 | 642 | $this->logger->info('The controller [' . $this->controller . '] not ' |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * or the current request does not use module |
654 | 654 | * @return void |
655 | 655 | */ |
656 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
656 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
657 | 657 | $segment = $this->segments; |
658 | 658 | //controller |
659 | 659 | if (isset($segment[0])) { |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * or the current request use module |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
677 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
678 | 678 | //get the module list |
679 | 679 | $modules = $this->moduleInstance->getModuleList(); |
680 | 680 | $segment = $this->segments; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | if (isset($segment[0])) { |
687 | 687 | $this->controller = $segment[0]; |
688 | 688 | //check if the request use the same module name and controller |
689 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
689 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
690 | 690 | array_shift($segment); |
691 | 691 | } |
692 | 692 | } |
@@ -522,8 +522,7 @@ |
||
522 | 522 | if(is_array($callback) && count($callback) > 0){ |
523 | 523 | if(array_key_exists($this->requestMethod, $callback)){ |
524 | 524 | $callback = $callback[$this->requestMethod]; |
525 | - } |
|
526 | - else{ |
|
525 | + } else{ |
|
527 | 526 | //Wrong request method |
528 | 527 | $this->logger->warning('The request method [' . $this->requestMethod . '] is not allowed'); |
529 | 528 | $this->routeMethodMatch = false; |