Passed
Push — master ( 63f321...eeb79a )
by Henri
01:21
created
src/Router.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
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
     }
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
             return $this->byName($route_name);
140 140
         }
141 141
 
142
-		$currentProtocol = $this->getProtocol();
142
+        $currentProtocol = $this->getProtocol();
143 143
 
144 144
         foreach(array_reverse($this->routers) as $r => $route){
145 145
 
146 146
             $this->hasProtocol($route, $currentProtocol);
147 147
 
148
-	        $route_loop = explode(
148
+            $route_loop = explode(
149 149
                 '/',
150 150
                 (substr($route['url'],strlen($route['url'])-1,1) === '/') 
151 151
                     ? substr($route['url'], 0, -1) 
@@ -154,26 +154,26 @@  discard block
 block discarded – undo
154 154
 
155 155
             /* ONLY FOR DEBUG CONDITION */
156 156
             $route_request = $route_loop;
157
-	        /*$route_request = explode(
157
+            /*$route_request = explode(
158 158
                 '/',
159 159
                 (substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1,1) === '/') 
160 160
                 ? substr($_SERVER['REQUEST_URI'], 0, -1) 
161 161
                 : $_SERVER['REQUEST_URI'] 
162 162
             );*/
163 163
 
164
-	        if(count($route_loop) !== count($route_request)){
164
+            if(count($route_loop) !== count($route_request)){
165 165
                 continue;
166 166
             }
167 167
 
168
-	        for($rr = 0; $rr < count($route_loop); $rr++){
169
-	            $param = (substr($route_loop[$rr],0,1)==='{');
168
+            for($rr = 0; $rr < count($route_loop); $rr++){
169
+                $param = (substr($route_loop[$rr],0,1)==='{');
170 170
 
171
-	            if($param){
171
+                if($param){
172 172
                     $param_name = substr($route_loop[$rr],1,strlen($route_loop[$rr])-2);
173
-	                $data[$param_name] = $route_request[$rr];
174
-	            }
173
+                    $data[$param_name] = $route_request[$rr];
174
+                }
175 175
 
176
-	            if(!$param and $route_loop[$rr] !== $route_request[$rr]){
176
+                if(!$param and $route_loop[$rr] !== $route_request[$rr]){
177 177
                     continue 2;
178 178
                 }
179 179
             }
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
             $this->check_filtering($route);
182 182
 
183 183
             $this->Controller($route['role']);
184
-	        return true;
185
-	    }
184
+            return true;
185
+        }
186 186
 
187
-	    throw new Exception('Page not found.',404);
187
+        throw new Exception('Page not found.',404);
188 188
     }
189 189
 
190 190
     public static function filter($filters): Router
Please login to merge, or discard this patch.
src/Helper.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.