@@ -77,7 +77,7 @@ |
||
77 | 77 | ->with($this->collection, $method, $path) |
78 | 78 | ->willReturn($actual); |
79 | 79 | |
80 | - $expected = $this->router->getRouterResponseFromPath($method,$path); |
|
80 | + $expected = $this->router->getRouterResponseFromPath($method, $path); |
|
81 | 81 | $this->assertEquals($expected, $actual); |
82 | 82 | } |
83 | 83 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $handler |
101 | 101 | * @return RouterResponse |
102 | 102 | */ |
103 | - public function withHandler(string $handler){ |
|
103 | + public function withHandler(string $handler) { |
|
104 | 104 | $new = clone $this; |
105 | 105 | $new->handler = $handler; |
106 | 106 | return $new; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param array $vars |
111 | 111 | * @return RouterResponse |
112 | 112 | */ |
113 | - public function withVars(array $vars){ |
|
113 | + public function withVars(array $vars) { |
|
114 | 114 | $new = clone $this; |
115 | 115 | $new->vars = $vars; |
116 | 116 | return $new; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param int $code |
121 | 121 | * @return RouterResponse |
122 | 122 | */ |
123 | - public function withStatusCode(int $code){ |
|
123 | + public function withStatusCode(int $code) { |
|
124 | 124 | $new = clone $this; |
125 | 125 | $new->statusCode = $code; |
126 | 126 | return $new; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param array $names |
131 | 131 | * @return RouterResponse |
132 | 132 | */ |
133 | - public function withNames(array $names){ |
|
133 | + public function withNames(array $names) { |
|
134 | 134 | $new = clone $this; |
135 | 135 | $new->names = $names; |
136 | 136 | return $new; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->adaptor = $adaptor; |
54 | 54 | $this->collection = $collection; |
55 | 55 | |
56 | - if (isset($options['ignoreTrailingSlash'])){ |
|
56 | + if (isset($options['ignoreTrailingSlash'])) { |
|
57 | 57 | $this->ignoreTrailingSlash = (bool)$options['ignoreTrailingSlash']; |
58 | 58 | } |
59 | 59 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $requestUri = $request->getUri()->getPath(); |
69 | 69 | |
70 | 70 | |
71 | - if ($this->ignoreTrailingSlash === true && $requestUri !== '/'){ |
|
72 | - $requestUri = rtrim($requestUri,'/'); |
|
71 | + if ($this->ignoreTrailingSlash === true && $requestUri !== '/') { |
|
72 | + $requestUri = rtrim($requestUri, '/'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $this->adaptor->match( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * @param bool $ignore |
155 | 155 | */ |
156 | - public function disableTrailingSlash($ignore = true){ |
|
156 | + public function disableTrailingSlash($ignore = true) { |
|
157 | 157 | $this->ignoreTrailingSlash = $ignore; |
158 | 158 | } |
159 | 159 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addNamespace(string $namespace) |
83 | 83 | { |
84 | - $formattedNamespace = '\\'.ltrim($namespace,'\\'); |
|
84 | + $formattedNamespace = '\\' . ltrim($namespace, '\\'); |
|
85 | 85 | $this->namespace[] = $formattedNamespace; |
86 | 86 | } |
87 | 87 | |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | |
231 | 231 | $route = \implode('', $this->group) . $routePattern; |
232 | 232 | |
233 | - if (substr($route, -1) === '/' && strlen($route) > 1){ |
|
234 | - $route = rtrim($route,'/'); |
|
233 | + if (substr($route, -1) === '/' && strlen($route) > 1) { |
|
234 | + $route = rtrim($route, '/'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $route; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ) |
254 | 254 | ); |
255 | 255 | $new->collection[] = $addRoute; |
256 | - } catch (\Exception $e) { |
|
256 | + }catch (\Exception $e) { |
|
257 | 257 | if ($throw) { |
258 | 258 | throw new RouteException($e->getMessage()); |
259 | 259 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->options = $options; |
136 | 136 | |
137 | 137 | return \FastRoute\cachedDispatcher( |
138 | - function (RouteCollector $fastRouteCollector) use ($routes) { |
|
138 | + function(RouteCollector $fastRouteCollector) use ($routes) { |
|
139 | 139 | /** |
140 | 140 | * @var $route RouteInterface |
141 | 141 | */ |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $routes = (array)require $cacheFile; |
234 | 234 | |
235 | 235 | foreach ($routes[0] as $routeMethod => $routeData) { |
236 | - foreach ($routeData as $routePattern => $routeContent){ |
|
236 | + foreach ($routeData as $routePattern => $routeContent) { |
|
237 | 237 | $routePath = \rtrim($context, '/') . DIRECTORY_SEPARATOR . \ltrim($routePattern, '/'); |
238 | 238 | $collection->addRoute($routeMethod, $routePath, $routeContent['content'], $routeContent['name']); |
239 | 239 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | //Routes collections can then be added to the router: |
30 | 30 | $routeCollection = new \Ds\Router\RouteCollection(); |
31 | -$routeCollection->addRoute('GET','/some-path','handler::string',['routeName']); |
|
31 | +$routeCollection->addRoute('GET', '/some-path', 'handler::string', ['routeName']); |
|
32 | 32 | $router->withCollection($routeCollection); |
33 | 33 | |
34 | 34 | $app = new \StdClass(); |