@@ -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 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $instance->getInstance()->byName($routeName); |
| 168 | 168 | |
| 169 | - $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 169 | + $currentProtocol = $instance->getInstance()->getProtocol(); |
|
| 170 | 170 | |
| 171 | 171 | foreach(array_reverse($instance->getInstance()->routers) as $r => $route){ |
| 172 | 172 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $instance->getInstance()->currentRoute = null; |
| 199 | 199 | |
| 200 | - throw new Exception('Page not found.',404); |
|
| 200 | + throw new Exception('Page not found.',404); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | public static function filter($filters): Router |