@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function setApplication(Application $application) |
18 | 18 | { |
19 | 19 | $this->application = $application; |
20 | - foreach($this->routes as $routeName => $controller) { |
|
20 | + foreach ($this->routes as $routeName => $controller) { |
|
21 | 21 | $this->application->registerController($controller, $routeName); |
22 | 22 | } |
23 | 23 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function getRoute(string $name) |
53 | 53 | { |
54 | - if(!$this->hasRoute($name)) { |
|
54 | + if (!$this->hasRoute($name)) { |
|
55 | 55 | throw new RouterException("Router {$router} is not registered"); |
56 | 56 | } |
57 | 57 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | { |
70 | 70 | $parts = \explode('/', $request->getOrigin()); |
71 | 71 | $found = false; |
72 | - for($i = 0; $i < count($parts); $i++) { |
|
73 | - if($parts[$i] === $name && isset($parts[$i+1])) { |
|
74 | - $action = $parts[$i+1]; |
|
75 | - if(strpos($action, "?")) { |
|
72 | + for ($i = 0; $i < count($parts); $i++) { |
|
73 | + if ($parts[$i] === $name && isset($parts[$i + 1])) { |
|
74 | + $action = $parts[$i + 1]; |
|
75 | + if (strpos($action, "?")) { |
|
76 | 76 | $action = strstr($action, "?", true); |
77 | 77 | } |
78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $found = true; |
81 | 81 | } |
82 | 82 | } |
83 | - if(!$found) { |
|
83 | + if (!$found) { |
|
84 | 84 | $request->setAction("index"); |
85 | 85 | } |
86 | 86 | $controller = $this->getRoute($name); |