@@ -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 | } |
@@ -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 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | |
153 | 153 | $route_request = $this->explodeRoute((substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') , $_SERVER['REQUEST_URI']); |
154 | 154 | |
155 | - if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
155 | + if($this->check_numparams($route_loop, $route_request) || !$this->check_parameters($route_loop, $route_request)){ |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | 159 | $this->check_filtering($route); |
160 | 160 | |
161 | 161 | $this->toHiking($route['role']); |
162 | - return true; |
|
163 | - } |
|
162 | + return true; |
|
163 | + } |
|
164 | 164 | |
165 | - throw new Exception('Page not found.',404); |
|
165 | + throw new Exception('Page not found.',404); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | public static function filter($filters): Router |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | } |
181 | 181 | |
182 | - self::getInstance()->lastReturn = null; |
|
182 | + self::getInstance()->lastReturn = null; |
|
183 | 183 | |
184 | 184 | return self::getInstance(); |
185 | 185 | } |