@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | protected function ControllerForm($controller, string $method, array $values){ |
| 43 | - if(Validator::execute($values)){ |
|
| 43 | + if(Validator::execute($values)){ |
|
| 44 | 44 | |
| 45 | 45 | $this->check_role(); |
| 46 | 46 | |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | |
| 71 | 71 | if( ( $this->getProtocol() == 'form') ){ |
| 72 | 72 | $this->ControllerForm($controller, $method, $data['POST']); |
| 73 | - }else { |
|
| 73 | + } else { |
|
| 74 | 74 | $controller->$method($data); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | Router::create()->dispatch(); |
| 13 | 13 | |
| 14 | -}catch(Exception $er){ |
|
| 14 | +} catch(Exception $er){ |
|
| 15 | 15 | |
| 16 | 16 | die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}."); |
| 17 | 17 | |
@@ -217,7 +217,7 @@ |
||
| 217 | 217 | foreach ($route['filters'] as $key => $value) { |
| 218 | 218 | $filters[] = $value; |
| 219 | 219 | } |
| 220 | - }else{ |
|
| 220 | + } else{ |
|
| 221 | 221 | $filters[] = $route['filters']; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function set($url , $role , $protocol = null): 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 | - $route = [ |
|
| 73 | - 'url' => $this->prefix.$url, |
|
| 74 | - 'role' => $role, |
|
| 75 | - 'protocol' => $protocol, |
|
| 76 | - 'filters' => null, |
|
| 72 | + $route = [ |
|
| 73 | + 'url' => $this->prefix.$url, |
|
| 74 | + 'role' => $role, |
|
| 75 | + 'protocol' => $protocol, |
|
| 76 | + 'filters' => null, |
|
| 77 | 77 | 'group' => self::getInstance()->group |
| 78 | - ]; |
|
| 78 | + ]; |
|
| 79 | 79 | |
| 80 | - $this->routers[] = $route; |
|
| 80 | + $this->routers[] = $route; |
|
| 81 | 81 | |
| 82 | 82 | return self::getInstance(); |
| 83 | 83 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $this->byName($route_name); |
| 142 | 142 | |
| 143 | - $currentProtocol = $this->getProtocol(); |
|
| 143 | + $currentProtocol = $this->getProtocol(); |
|
| 144 | 144 | |
| 145 | 145 | foreach(array_reverse($this->routers) as $r => $route){ |
| 146 | 146 | |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $route_request = $this->explodeRoute((substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') , $_SERVER['REQUEST_URI']); |
| 152 | 152 | |
| 153 | - if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
| 153 | + if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
| 154 | 154 | continue; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $this->check_filtering($route); |
| 158 | 158 | |
| 159 | 159 | $this->Controller($route['role']); |
| 160 | - return true; |
|
| 161 | - } |
|
| 160 | + return true; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - throw new Exception('Page not found.',404); |
|
| 163 | + throw new Exception('Page not found.',404); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | public static function filter($filters): Router |