@@ -96,8 +96,9 @@ discard block |
||
96 | 96 | { |
97 | 97 | foreach ($currentRoute->middleware as $middleware) |
98 | 98 | { |
99 | - if (!in_array($middleware, $_run)) |
|
100 | - $_run[] = $middleware; |
|
99 | + if (!in_array($middleware, $_run)) { |
|
100 | + $_run[] = $middleware; |
|
101 | + } |
|
101 | 102 | } |
102 | 103 | } |
103 | 104 | |
@@ -125,31 +126,36 @@ discard block |
||
125 | 126 | |
126 | 127 | $middlewareName = ucfirst($middlewareName).'_middleware'; |
127 | 128 | |
128 | - if (!file_exists($middlewareDir)) |
|
129 | - show_error('Unable to find (or read) the middleware folder: "'.$middlewareDir.'"'); |
|
129 | + if (!file_exists($middlewareDir)) { |
|
130 | + show_error('Unable to find (or read) the middleware folder: "'.$middlewareDir.'"'); |
|
131 | + } |
|
130 | 132 | |
131 | 133 | $runMiddleware = $middlewareDir.$middlewareName.'.php'; |
132 | 134 | |
133 | - if (!file_exists($runMiddleware)) |
|
134 | - show_error('Unable to find (or read) the middleware "'.$runMiddleware.'"'); |
|
135 | + if (!file_exists($runMiddleware)) { |
|
136 | + show_error('Unable to find (or read) the middleware "'.$runMiddleware.'"'); |
|
137 | + } |
|
135 | 138 | |
136 | 139 | require $runMiddleware; |
137 | 140 | |
138 | - if (!class_exists($middlewareName)) |
|
139 | - show_error('Class "'.$middlewareName.'" not found'); |
|
141 | + if (!class_exists($middlewareName)) { |
|
142 | + show_error('Class "'.$middlewareName.'" not found'); |
|
143 | + } |
|
140 | 144 | |
141 | 145 | $middleware = new $middlewareName(); |
142 | 146 | |
143 | 147 | // Call the current controller __beforeMiddleware() method, if exists: |
144 | - if (method_exists(self::$instance, '_beforeMiddleware')) |
|
145 | - self::$instance->_beforeMiddleware(); |
|
148 | + if (method_exists(self::$instance, '_beforeMiddleware')) { |
|
149 | + self::$instance->_beforeMiddleware(); |
|
150 | + } |
|
146 | 151 | |
147 | 152 | // Run the middleware |
148 | 153 | $middleware->run(); |
149 | 154 | |
150 | 155 | // Call the current controller _afterMiddleware() method, if exists: |
151 | - if (method_exists(self::$instance, '_afterMiddleware')) |
|
152 | - self::$instance->_afterMiddleware(); |
|
156 | + if (method_exists(self::$instance, '_afterMiddleware')) { |
|
157 | + self::$instance->_afterMiddleware(); |
|
158 | + } |
|
153 | 159 | |
154 | 160 | } |
155 | 161 | } |
@@ -117,16 +117,16 @@ |
||
117 | 117 | |
118 | 118 | // Redirect to 404 if not enough parameters provided |
119 | 119 | |
120 | - if(count($path_args) < count($route_args['required'])) |
|
120 | + if (count($path_args) < count($route_args['required'])) |
|
121 | 121 | redirect(Route::get404()->path); |
122 | 122 | |
123 | - if(count($path_args) == 0) |
|
123 | + if (count($path_args) == 0) |
|
124 | 124 | { |
125 | 125 | $this->CI->{$this->route->method}(); |
126 | 126 | } |
127 | 127 | else |
128 | 128 | { |
129 | - call_user_func_array( [$this->CI, $this->route->method], array_values($path_args) ); |
|
129 | + call_user_func_array([$this->CI, $this->route->method], array_values($path_args)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 |
@@ -64,20 +64,22 @@ discard block |
||
64 | 64 | |
65 | 65 | // FIXME: Solve ambiguity here! POST with _method="GET" makes no sense |
66 | 66 | |
67 | - if (isset($_POST['_method']) && in_array(strtoupper($_POST['_method']), $validMethods, TRUE)) |
|
68 | - $formMethod = strtoupper($_POST['_method']); |
|
67 | + if (isset($_POST['_method']) && in_array(strtoupper($_POST['_method']), $validMethods, TRUE)) { |
|
68 | + $formMethod = strtoupper($_POST['_method']); |
|
69 | + } |
|
69 | 70 | |
70 | 71 | if (is_null($formMethod)) |
71 | 72 | { |
72 | 73 | $this->requestMethod = $requestMethod; |
73 | - } |
|
74 | - else |
|
74 | + } else |
|
75 | 75 | { |
76 | - if ($requestMethod == 'POST') |
|
77 | - $this->requestMethod = $formMethod; |
|
76 | + if ($requestMethod == 'POST') { |
|
77 | + $this->requestMethod = $formMethod; |
|
78 | + } |
|
78 | 79 | |
79 | - if (!$this->CI->input->is_ajax_request() && $this->requestMethod == 'HEAD') |
|
80 | - $this->requestMethod = 'POST'; |
|
80 | + if (!$this->CI->input->is_ajax_request() && $this->requestMethod == 'HEAD') { |
|
81 | + $this->requestMethod = 'POST'; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | } |
83 | 85 | |
@@ -117,14 +119,14 @@ discard block |
||
117 | 119 | |
118 | 120 | // Redirect to 404 if not enough parameters provided |
119 | 121 | |
120 | - if(count($path_args) < count($route_args['required'])) |
|
121 | - redirect(Route::get404()->path); |
|
122 | + if(count($path_args) < count($route_args['required'])) { |
|
123 | + redirect(Route::get404()->path); |
|
124 | + } |
|
122 | 125 | |
123 | 126 | if(count($path_args) == 0) |
124 | 127 | { |
125 | 128 | $this->CI->{$this->route->method}(); |
126 | - } |
|
127 | - else |
|
129 | + } else |
|
128 | 130 | { |
129 | 131 | call_user_func_array( [$this->CI, $this->route->method], array_values($path_args) ); |
130 | 132 | } |
@@ -134,14 +136,12 @@ discard block |
||
134 | 136 | |
135 | 137 | $this->CI->output->_display(); |
136 | 138 | exit(0); |
137 | - } |
|
138 | - else |
|
139 | + } else |
|
139 | 140 | { |
140 | 141 | if (ENVIRONMENT != 'production') |
141 | 142 | { |
142 | 143 | show_error('The method '.$this->route->controller.'::'.$this->route->method.'() does not exists', 500, 'Method not found'); |
143 | - } |
|
144 | - else |
|
144 | + } else |
|
145 | 145 | { |
146 | 146 | //redirect(Route::get404()->path); |
147 | 147 | Route::trigger404(); |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $customRegex = FALSE; |
570 | 570 | foreach ($replaces as $regex => $replace) |
571 | 571 | { |
572 | - if($customRegex) |
|
572 | + if ($customRegex) |
|
573 | 573 | continue; |
574 | 574 | |
575 | 575 | $matches = []; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $c = 0; |
583 | 583 | $segment = preg_replace('/'.$regex.'/', $replace, $segment, 1, $c); |
584 | 584 | |
585 | - if( $regex == array_keys($replaces)[0] && $c > 0) |
|
585 | + if ($regex == array_keys($replaces)[0] && $c > 0) |
|
586 | 586 | $customRegex = TRUE; |
587 | 587 | } |
588 | 588 | } |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | { |
1016 | 1016 | for ($i = 0; $i < count($e_findPath); $i++) |
1017 | 1017 | { |
1018 | - if(in_array($i, $skip_seg)) |
|
1018 | + if (in_array($i, $skip_seg)) |
|
1019 | 1019 | continue; |
1020 | 1020 | |
1021 | 1021 | if ($valid) |
@@ -146,11 +146,13 @@ discard block |
||
146 | 146 | $controller = $parsedController[1]; |
147 | 147 | $method = $parsedController[2]; |
148 | 148 | |
149 | - if (!is_string($path)) |
|
150 | - show_error('Route path must be a string ', 500, 'Route error: bad route path'); |
|
149 | + if (!is_string($path)) { |
|
150 | + show_error('Route path must be a string ', 500, 'Route error: bad route path'); |
|
151 | + } |
|
151 | 152 | |
152 | - if (!is_string($verb)) |
|
153 | - show_error('Route HTTP Verb must be a string', 500, 'Route error: bad verb type'); |
|
153 | + if (!is_string($verb)) { |
|
154 | + show_error('Route HTTP Verb must be a string', 500, 'Route error: bad verb type'); |
|
155 | + } |
|
154 | 156 | |
155 | 157 | $verb = strtoupper($verb); |
156 | 158 | |
@@ -186,30 +188,36 @@ discard block |
||
186 | 188 | $route['prefix'] = NULL; |
187 | 189 | $group_prefix = implode('/', self::$prefix); |
188 | 190 | |
189 | - if ($group_prefix) |
|
190 | - $route['prefix'] = $group_prefix.'/'; |
|
191 | + if ($group_prefix) { |
|
192 | + $route['prefix'] = $group_prefix.'/'; |
|
193 | + } |
|
191 | 194 | |
192 | - if (isset($attr['prefix'])) |
|
193 | - $route['prefix'] .= $attr['prefix']; |
|
195 | + if (isset($attr['prefix'])) { |
|
196 | + $route['prefix'] .= $attr['prefix']; |
|
197 | + } |
|
194 | 198 | |
195 | 199 | // Setting up the namespace |
196 | 200 | |
197 | 201 | $route['namespace'] = NULL; |
198 | 202 | $group_namespace = implode('/', self::$namespace); |
199 | 203 | |
200 | - if (!is_null($group_namespace)) |
|
201 | - $route['namespace'] = $group_namespace.'/'; |
|
202 | - if (isset($attr['namespace'])) |
|
203 | - $route['namespace'] .= $attr['namespace']; |
|
204 | + if (!is_null($group_namespace)) { |
|
205 | + $route['namespace'] = $group_namespace.'/'; |
|
206 | + } |
|
207 | + if (isset($attr['namespace'])) { |
|
208 | + $route['namespace'] .= $attr['namespace']; |
|
209 | + } |
|
204 | 210 | |
205 | 211 | $route['prefix'] = trim($route['prefix'], '/'); |
206 | 212 | $route['namespace'] = trim($route['namespace'], '/'); |
207 | 213 | |
208 | - if (empty($route['prefix'])) |
|
209 | - $route['prefix'] = NULL; |
|
214 | + if (empty($route['prefix'])) { |
|
215 | + $route['prefix'] = NULL; |
|
216 | + } |
|
210 | 217 | |
211 | - if (empty($route['namespace'])) |
|
212 | - $route['namespace'] = NULL; |
|
218 | + if (empty($route['namespace'])) { |
|
219 | + $route['namespace'] = NULL; |
|
220 | + } |
|
213 | 221 | |
214 | 222 | // Route middleware |
215 | 223 | $route['middleware'] = []; |
@@ -219,14 +227,14 @@ discard block |
||
219 | 227 | { |
220 | 228 | if (is_array($attr['middleware'])) |
221 | 229 | { |
222 | - foreach ($attr['middleware'] as $middleware) |
|
223 | - $route['middleware'][] = $middleware; # Group |
|
224 | - } |
|
225 | - elseif (is_string($attr['middleware'])) |
|
230 | + foreach ($attr['middleware'] as $middleware) { |
|
231 | + $route['middleware'][] = $middleware; |
|
232 | + } |
|
233 | + # Group |
|
234 | + } elseif (is_string($attr['middleware'])) |
|
226 | 235 | { |
227 | 236 | $route['middleware'][] = $attr['middleware']; # Group |
228 | - } |
|
229 | - else |
|
237 | + } else |
|
230 | 238 | { |
231 | 239 | show_error('Route middleware must be a string or an array', 500, 'Route error: bad middleware format'); |
232 | 240 | } |
@@ -398,8 +406,9 @@ discard block |
||
398 | 406 | */ |
399 | 407 | public static function matches($verbs, $url, $attr, $hideOriginal = FALSE) |
400 | 408 | { |
401 | - if (!is_array($verbs)) |
|
402 | - show_error('Route::matches() first argument must be an array of valid HTTP Verbs', 500, 'Route error: bad Route::matches() verb list'); |
|
409 | + if (!is_array($verbs)) { |
|
410 | + show_error('Route::matches() first argument must be an array of valid HTTP Verbs', 500, 'Route error: bad Route::matches() verb list'); |
|
411 | + } |
|
403 | 412 | |
404 | 413 | foreach ($verbs as $verb) |
405 | 414 | { |
@@ -427,19 +436,23 @@ discard block |
||
427 | 436 | |
428 | 437 | $hideOriginal = FALSE; |
429 | 438 | |
430 | - if (isset($attr['namespace'])) |
|
431 | - $base_attr['namespace'] = $attr['namespace']; |
|
439 | + if (isset($attr['namespace'])) { |
|
440 | + $base_attr['namespace'] = $attr['namespace']; |
|
441 | + } |
|
432 | 442 | |
433 | - if (isset($attr['middleware'])) |
|
434 | - $base_attr['middleware'] = $attr['middleware']; |
|
443 | + if (isset($attr['middleware'])) { |
|
444 | + $base_attr['middleware'] = $attr['middleware']; |
|
445 | + } |
|
435 | 446 | |
436 | - if (isset($attr['hideOriginal'])) |
|
437 | - $hideOriginal = (bool) $attr['hideOriginal']; |
|
447 | + if (isset($attr['hideOriginal'])) { |
|
448 | + $hideOriginal = (bool) $attr['hideOriginal']; |
|
449 | + } |
|
438 | 450 | |
439 | 451 | $base_attr['prefix'] = strtolower($name); |
440 | 452 | |
441 | - if (isset($attr['prefix'])) |
|
442 | - $base_attr['prefix'] = $attr['prefix']; |
|
453 | + if (isset($attr['prefix'])) { |
|
454 | + $base_attr['prefix'] = $attr['prefix']; |
|
455 | + } |
|
443 | 456 | |
444 | 457 | $only = []; |
445 | 458 | |
@@ -450,8 +463,7 @@ discard block |
||
450 | 463 | if (is_array($attr['only'])) |
451 | 464 | { |
452 | 465 | $only = $attr['only']; |
453 | - } |
|
454 | - else |
|
466 | + } else |
|
455 | 467 | { |
456 | 468 | $only[] = $attr['only']; |
457 | 469 | } |
@@ -528,13 +540,15 @@ discard block |
||
528 | 540 | |
529 | 541 | $path = $route->path; |
530 | 542 | |
531 | - if (!is_null($prefix)) |
|
532 | - $path = $prefix.'/'.$path; |
|
543 | + if (!is_null($prefix)) { |
|
544 | + $path = $prefix.'/'.$path; |
|
545 | + } |
|
533 | 546 | |
534 | 547 | $controller = $route->controller.'/'.$route->method; |
535 | 548 | |
536 | - if (!is_null($namespace)) |
|
537 | - $controller = $namespace.'/'.$controller; |
|
549 | + if (!is_null($namespace)) { |
|
550 | + $controller = $namespace.'/'.$controller; |
|
551 | + } |
|
538 | 552 | |
539 | 553 | $path = trim($path, '/'); |
540 | 554 | $controller = trim($controller, '/'); |
@@ -569,8 +583,9 @@ discard block |
||
569 | 583 | $customRegex = FALSE; |
570 | 584 | foreach ($replaces as $regex => $replace) |
571 | 585 | { |
572 | - if($customRegex) |
|
573 | - continue; |
|
586 | + if($customRegex) { |
|
587 | + continue; |
|
588 | + } |
|
574 | 589 | |
575 | 590 | $matches = []; |
576 | 591 | |
@@ -582,8 +597,9 @@ discard block |
||
582 | 597 | $c = 0; |
583 | 598 | $segment = preg_replace('/'.$regex.'/', $replace, $segment, 1, $c); |
584 | 599 | |
585 | - if( $regex == array_keys($replaces)[0] && $c > 0) |
|
586 | - $customRegex = TRUE; |
|
600 | + if( $regex == array_keys($replaces)[0] && $c > 0) { |
|
601 | + $customRegex = TRUE; |
|
602 | + } |
|
587 | 603 | } |
588 | 604 | } |
589 | 605 | |
@@ -601,11 +617,11 @@ discard block |
||
601 | 617 | { |
602 | 618 | $args['optional'][] = $arg; |
603 | 619 | $argConstraint = TRUE; |
604 | - } |
|
605 | - else |
|
620 | + } else |
|
606 | 621 | { |
607 | - if ($argConstraint) |
|
608 | - show_error('Optional route path argument not valid at this position', 500, 'Route error'); |
|
622 | + if ($argConstraint) { |
|
623 | + show_error('Optional route path argument not valid at this position', 500, 'Route error'); |
|
624 | + } |
|
609 | 625 | $args['required'][] = $arg; |
610 | 626 | } |
611 | 627 | } |
@@ -715,12 +731,14 @@ discard block |
||
715 | 731 | $path = key($route); |
716 | 732 | $_404 = $route[$path]; |
717 | 733 | |
718 | - if (!isset($routes[$path])) |
|
719 | - $routes[$path] = $_404; |
|
734 | + if (!isset($routes[$path])) { |
|
735 | + $routes[$path] = $_404; |
|
736 | + } |
|
720 | 737 | } |
721 | 738 | |
722 | - if (is_null(self::$defaultController)) |
|
723 | - show_error('You must specify a home route: Route::home() as default controller!', 500, 'Route error: missing default controller'); |
|
739 | + if (is_null(self::$defaultController)) { |
|
740 | + show_error('You must specify a home route: Route::home() as default controller!', 500, 'Route error: missing default controller'); |
|
741 | + } |
|
724 | 742 | |
725 | 743 | $defaultController = self::$defaultController->compiled; |
726 | 744 | $defaultController = $defaultController[key($defaultController)]; |
@@ -754,11 +772,13 @@ discard block |
||
754 | 772 | */ |
755 | 773 | public static function group($attr, $routes) |
756 | 774 | { |
757 | - if (!is_array($attr)) |
|
758 | - show_error('Group attribute must be a valid array'); |
|
775 | + if (!is_array($attr)) { |
|
776 | + show_error('Group attribute must be a valid array'); |
|
777 | + } |
|
759 | 778 | |
760 | - if (!isset($attr['prefix'])) |
|
761 | - show_error('You must specify an prefix!'); |
|
779 | + if (!isset($attr['prefix'])) { |
|
780 | + show_error('You must specify an prefix!'); |
|
781 | + } |
|
762 | 782 | |
763 | 783 | self::$prefix[] = $attr['prefix']; |
764 | 784 | |
@@ -781,15 +801,14 @@ discard block |
||
781 | 801 | { |
782 | 802 | if (is_array($attr['middleware']) && !empty($attr['middleware'])) |
783 | 803 | { |
784 | - foreach ($attr['middleware'] as $middleware) |
|
785 | - self::$middleware[] = $middleware; |
|
786 | - } |
|
787 | - else |
|
804 | + foreach ($attr['middleware'] as $middleware) { |
|
805 | + self::$middleware[] = $middleware; |
|
806 | + } |
|
807 | + } else |
|
788 | 808 | { |
789 | 809 | self::$middleware[] = $attr['middleware']; |
790 | 810 | } |
791 | - } |
|
792 | - else |
|
811 | + } else |
|
793 | 812 | { |
794 | 813 | show_error('Group middleware must be an array o a string', 500, 'Route error'); |
795 | 814 | } |
@@ -821,14 +840,17 @@ discard block |
||
821 | 840 | 'as' => $as |
822 | 841 | ]; |
823 | 842 | |
824 | - if (!is_null($attr) && !is_array($attr)) |
|
825 | - show_error('Default controller attributes must be an array', 500, 'Route error: bad attribute type'); |
|
843 | + if (!is_null($attr) && !is_array($attr)) { |
|
844 | + show_error('Default controller attributes must be an array', 500, 'Route error: bad attribute type'); |
|
845 | + } |
|
826 | 846 | |
827 | - if (!is_null($attr)) |
|
828 | - $routeAttr = array_merge($routeAttr, $attr); |
|
847 | + if (!is_null($attr)) { |
|
848 | + $routeAttr = array_merge($routeAttr, $attr); |
|
849 | + } |
|
829 | 850 | |
830 | - if (isset($attr['prefix'])) |
|
831 | - show_error('Default controller may not have a prefix!', 500, 'Route error: prefix not allowed'); |
|
851 | + if (isset($attr['prefix'])) { |
|
852 | + show_error('Default controller may not have a prefix!', 500, 'Route error: prefix not allowed'); |
|
853 | + } |
|
832 | 854 | |
833 | 855 | self::$defaultController = self::$routes[] = self::add('GET', '/', ['uses' => $controller, 'as' => $as], TRUE, TRUE); |
834 | 856 | } |
@@ -847,14 +869,14 @@ discard block |
||
847 | 869 | if (is_null($verb)) |
848 | 870 | { |
849 | 871 | return self::$routes; |
850 | - } |
|
851 | - else |
|
872 | + } else |
|
852 | 873 | { |
853 | 874 | $routes = []; |
854 | 875 | foreach (self::$routes as $route) |
855 | 876 | { |
856 | - if ($route->verb == $verb) |
|
857 | - $routes[] = $route; |
|
877 | + if ($route->verb == $verb) { |
|
878 | + $routes[] = $route; |
|
879 | + } |
|
858 | 880 | } |
859 | 881 | return $routes; |
860 | 882 | } |
@@ -951,18 +973,21 @@ discard block |
||
951 | 973 | */ |
952 | 974 | public static function getRouteByPath($path, $requestMethod = NULL) |
953 | 975 | { |
954 | - if (is_null($requestMethod)) |
|
955 | - $requestMethod = $_SERVER['REQUEST_METHOD']; |
|
976 | + if (is_null($requestMethod)) { |
|
977 | + $requestMethod = $_SERVER['REQUEST_METHOD']; |
|
978 | + } |
|
956 | 979 | |
957 | 980 | $routes = self::getRoutes($requestMethod); |
958 | 981 | |
959 | - if (empty($routes)) |
|
960 | - return FALSE; |
|
982 | + if (empty($routes)) { |
|
983 | + return FALSE; |
|
984 | + } |
|
961 | 985 | |
962 | 986 | $path = trim($path); |
963 | 987 | |
964 | - if ($path == '') |
|
965 | - return self::$defaultController; |
|
988 | + if ($path == '') { |
|
989 | + return self::$defaultController; |
|
990 | + } |
|
966 | 991 | |
967 | 992 | $wildcards = |
968 | 993 | [ |
@@ -988,10 +1013,10 @@ discard block |
||
988 | 1013 | |
989 | 1014 | if ($mode == 'exact') |
990 | 1015 | { |
991 | - if ($findPath == $compiledPath) |
|
992 | - return $route; |
|
993 | - } |
|
994 | - else |
|
1016 | + if ($findPath == $compiledPath) { |
|
1017 | + return $route; |
|
1018 | + } |
|
1019 | + } else |
|
995 | 1020 | { |
996 | 1021 | $e_findPath = explode('/', $findPath); |
997 | 1022 | $e_compiledPath = explode('/', $compiledPath); |
@@ -1007,24 +1032,28 @@ discard block |
||
1007 | 1032 | $reg = preg_replace($wildcards, $replaces, $e_compiledPath[$i], -1, $count); |
1008 | 1033 | $valid = (bool) preg_match('#^'.$reg.'$#', $e_findPath[$i]); |
1009 | 1034 | |
1010 | - if ($valid && $count > 0) |
|
1011 | - $skip_seg[] = $i; |
|
1035 | + if ($valid && $count > 0) { |
|
1036 | + $skip_seg[] = $i; |
|
1037 | + } |
|
1012 | 1038 | } |
1013 | 1039 | |
1014 | 1040 | if ($valid) |
1015 | 1041 | { |
1016 | 1042 | for ($i = 0; $i < count($e_findPath); $i++) |
1017 | 1043 | { |
1018 | - if(in_array($i, $skip_seg)) |
|
1019 | - continue; |
|
1044 | + if(in_array($i, $skip_seg)) { |
|
1045 | + continue; |
|
1046 | + } |
|
1020 | 1047 | |
1021 | - if ($valid) |
|
1022 | - $valid = $e_findPath[$i] == $e_compiledPath[$i]; |
|
1048 | + if ($valid) { |
|
1049 | + $valid = $e_findPath[$i] == $e_compiledPath[$i]; |
|
1050 | + } |
|
1023 | 1051 | } |
1024 | 1052 | } |
1025 | 1053 | |
1026 | - if ($valid) |
|
1027 | - return $route; |
|
1054 | + if ($valid) { |
|
1055 | + return $route; |
|
1056 | + } |
|
1028 | 1057 | } |
1029 | 1058 | } |
1030 | 1059 | } |
@@ -1058,8 +1087,9 @@ discard block |
||
1058 | 1087 | |
1059 | 1088 | for ($s = 0; $s < count($r_seg); $s++) |
1060 | 1089 | { |
1061 | - if (!isset($p_seg[$s])) |
|
1062 | - continue; |
|
1090 | + if (!isset($p_seg[$s])) { |
|
1091 | + continue; |
|
1092 | + } |
|
1063 | 1093 | |
1064 | 1094 | if ($r_seg[$s] != $p_seg[$s]) |
1065 | 1095 | { |