@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function ControllerForm($controller, string $method, array $values){ |
| 36 | - $this->checkRole(); |
|
| 36 | + $this->checkRole(); |
|
| 37 | 37 | $method = ($method !== 'method') ? $method : $this->getData()['POST']['role']; |
| 38 | 38 | $data = (!is_null($values)) ? json_decode($values['data'], true) : null; |
| 39 | 39 | |
@@ -89,25 +89,25 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function set($url ,$walking , string $protocol): Router |
| 91 | 91 | { |
| 92 | - $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 92 | + $url = (substr($url,0,1) !=='/' and strlen($url) > 0) ? "/{$url}" : $url; |
|
| 93 | 93 | |
| 94 | - foreach($this->routers as $key => $value){ |
|
| 95 | - if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 94 | + foreach($this->routers as $key => $value){ |
|
| 95 | + if( md5($this->prefix . $value['url'] . $value['protocol'] ) === md5( $url . $protocol ) ){ |
|
| 96 | 96 | throw new Exception("There is already a route with the url {$url} and with the {$protocol} protocol configured."); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $this->checkTypeRole($walking); |
| 101 | 101 | |
| 102 | - $route = [ |
|
| 103 | - 'url' => $this->prefix.$url, |
|
| 104 | - 'role' => $walking, |
|
| 105 | - 'protocol' => $protocol, |
|
| 106 | - 'filters' => null, |
|
| 102 | + $route = [ |
|
| 103 | + 'url' => $this->prefix.$url, |
|
| 104 | + 'role' => $walking, |
|
| 105 | + 'protocol' => $protocol, |
|
| 106 | + 'filters' => null, |
|
| 107 | 107 | 'group' => self::getInstance()->group |
| 108 | - ]; |
|
| 108 | + ]; |
|
| 109 | 109 | |
| 110 | - $this->routers[] = $route; |
|
| 110 | + $this->routers[] = $route; |
|
| 111 | 111 | |
| 112 | 112 | return self::getInstance(); |
| 113 | 113 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $instance->getInstance()->byName($routeName); |
| 174 | 174 | |
| 175 | - $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 175 | + $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 176 | 176 | |
| 177 | 177 | foreach(array_reverse($instance->getInstance()->routers) as $r => $route){ |
| 178 | 178 | |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $routeRequest = $instance->getInstance()->explodeRoute((substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') , $_SERVER['REQUEST_URI']); |
| 192 | 192 | |
| 193 | - if($instance->getInstance()->checkNumparams($routeLoop, $routeRequest) || !$instance->getInstance()->checkParameters($routeLoop, $routeRequest)){ |
|
| 193 | + if($instance->getInstance()->checkNumparams($routeLoop, $routeRequest) || !$instance->getInstance()->checkParameters($routeLoop, $routeRequest)){ |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $instance->getInstance()->checkFiltering($route); |
| 198 | 198 | |
| 199 | 199 | $instance->getInstance()->toHiking($route['role']); |
| 200 | - return true; |
|
| 200 | + return true; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $instance->getInstance()->currentRoute = null; |
| 204 | 204 | |
| 205 | - throw new Exception('Page not found.',404); |
|
| 205 | + throw new Exception('Page not found.',404); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | public static function filter($filters): Router |