@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function ControllerForm($controller, string $method, array $values){ |
| 36 | - $this->check_role(); |
|
| 36 | + $this->check_role(); |
|
| 37 | 37 | $role = ($method !== 'method') ? $method : $this->getData()['POST']['role']; |
| 38 | 38 | $data = (!is_null($values)) ? json_decode($values['data']) : null; |
| 39 | 39 | $controller->$role($data); |
@@ -61,25 +61,25 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function set($url ,$walking , string $protocol): Router |
| 63 | 63 | { |
| 64 | - $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 64 | + $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 65 | 65 | |
| 66 | - foreach($this->routers as $key => $value){ |
|
| 67 | - if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 66 | + foreach($this->routers as $key => $value){ |
|
| 67 | + if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 68 | 68 | throw new Exception("There is already a route with the url {$url} and with the {$protocol} protocol configured."); |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->check_typeRole($walking); |
| 73 | 73 | |
| 74 | - $route = [ |
|
| 75 | - 'url' => $this->prefix.$url, |
|
| 76 | - 'role' => $walking, |
|
| 77 | - 'protocol' => $protocol, |
|
| 78 | - 'filters' => null, |
|
| 74 | + $route = [ |
|
| 75 | + 'url' => $this->prefix.$url, |
|
| 76 | + 'role' => $walking, |
|
| 77 | + 'protocol' => $protocol, |
|
| 78 | + 'filters' => null, |
|
| 79 | 79 | 'group' => self::getInstance()->group |
| 80 | - ]; |
|
| 80 | + ]; |
|
| 81 | 81 | |
| 82 | - $this->routers[] = $route; |
|
| 82 | + $this->routers[] = $route; |
|
| 83 | 83 | |
| 84 | 84 | return self::getInstance(); |
| 85 | 85 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $this->byName($route_name); |
| 143 | 143 | |
| 144 | - $currentProtocol = $this->getProtocol(); |
|
| 144 | + $currentProtocol = $this->getProtocol(); |
|
| 145 | 145 | |
| 146 | 146 | foreach(array_reverse($this->routers) as $r => $route){ |
| 147 | 147 | |
@@ -151,17 +151,17 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $route_request = $this->explodeRoute((substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') , $_SERVER['REQUEST_URI']); |
| 153 | 153 | |
| 154 | - if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
| 154 | + if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
| 155 | 155 | continue; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $this->check_filtering($route); |
| 159 | 159 | |
| 160 | 160 | $this->toHiking($route['role']); |
| 161 | - return true; |
|
| 162 | - } |
|
| 161 | + return true; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - throw new Exception('Page not found.',404); |
|
| 164 | + throw new Exception('Page not found.',404); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public static function filter($filters): Router |