@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | protected function ControllerForm($controller, string $method, array $values){ |
| 53 | - $this->checkRole(); |
|
| 53 | + $this->checkRole(); |
|
| 54 | 54 | $method = ($method !== 'method') ? $method : $this->getData()['POST']['role']; |
| 55 | 55 | $data = (array_key_exists('data',$values)) ? json_decode($values['data'], true) : null; |
| 56 | 56 | |
@@ -71,26 +71,26 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function set($url ,$walking , string $protocol): Router |
| 73 | 73 | { |
| 74 | - $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 74 | + $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 75 | 75 | |
| 76 | - foreach($this->routers as $key => $value){ |
|
| 77 | - if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 76 | + foreach($this->routers as $key => $value){ |
|
| 77 | + if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 78 | 78 | throw new Exception("There is already a route with the url {$url} and with the {$protocol} protocol configured."); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $this->checkTypeRole($walking); |
| 83 | 83 | |
| 84 | - $route = [ |
|
| 85 | - 'url' => $this->prefix.$url, |
|
| 86 | - 'role' => $walking, |
|
| 87 | - 'protocol' => $protocol, |
|
| 84 | + $route = [ |
|
| 85 | + 'url' => $this->prefix.$url, |
|
| 86 | + 'role' => $walking, |
|
| 87 | + 'protocol' => $protocol, |
|
| 88 | 88 | 'filters' => null, |
| 89 | 89 | 'where' => null, |
| 90 | 90 | 'group' => self::getInstance()->group |
| 91 | - ]; |
|
| 91 | + ]; |
|
| 92 | 92 | |
| 93 | - $this->routers[] = $route; |
|
| 93 | + $this->routers[] = $route; |
|
| 94 | 94 | |
| 95 | 95 | return self::getInstance(); |
| 96 | 96 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $instance->getInstance()->byName($routeName); |
| 191 | 191 | |
| 192 | - $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 192 | + $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 193 | 193 | |
| 194 | 194 | foreach(array_reverse($instance->getInstance()->routers) as $r => $route){ |
| 195 | 195 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $routeRequest = $instance->getInstance()->explodeRoute((substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') , $_SERVER['REQUEST_URI']); |
| 209 | 209 | |
| 210 | - if($instance->getInstance()->checkNumparams($routeLoop, $routeRequest) || !$instance->getInstance()->checkParameters($routeLoop, $routeRequest)){ |
|
| 210 | + if($instance->getInstance()->checkNumparams($routeLoop, $routeRequest) || !$instance->getInstance()->checkParameters($routeLoop, $routeRequest)){ |
|
| 211 | 211 | continue; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $instance->getInstance()->currentRoute = null; |
| 225 | 225 | |
| 226 | - throw new Exception('Page not found.',404); |
|
| 226 | + throw new Exception('Page not found.',404); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | public static function filter($filters): Router |