@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | public function testArrayRoutes(): void |
| 222 | 222 | { |
| 223 | 223 | $router = new \Mezon\Router\Router(); |
| 224 | - $router->addRoute('/part1/part2/', function ($route) { |
|
| 224 | + $router->addRoute('/part1/part2/', function($route) { |
|
| 225 | 225 | return $route; |
| 226 | 226 | }, 'GET'); |
| 227 | 227 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $this->setRequestUri('/catalog/item/'); |
| 242 | 242 | |
| 243 | 243 | $router = new \Mezon\Router\Router(); |
| 244 | - $router->addRoute('/catalog/item/', function ($route) { |
|
| 244 | + $router->addRoute('/catalog/item/', function($route) { |
|
| 245 | 245 | return $route; |
| 246 | 246 | }, 'GET'); |
| 247 | 247 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $this->setRequestUri('/'); |
| 261 | 261 | |
| 262 | 262 | $router = new \Mezon\Router\Router(); |
| 263 | - $router->addRoute('/index/', function ($route) { |
|
| 263 | + $router->addRoute('/index/', function($route) { |
|
| 264 | 264 | return $route; |
| 265 | 265 | }, 'GET'); |
| 266 | 266 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $this->setRequestUri('/'); |
| 281 | 281 | |
| 282 | 282 | $router = new \Mezon\Router\Router(); |
| 283 | - $router->addRoute('/index/', function ($route) { |
|
| 283 | + $router->addRoute('/index/', function($route) { |
|
| 284 | 284 | return $route; |
| 285 | 285 | }, [ |
| 286 | 286 | 'GET', |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | public function testClearMethod(string $method): void |
| 403 | 403 | { |
| 404 | 404 | $router = new \Mezon\Router\Router(); |
| 405 | - $router->addRoute('/route-to-clear/', function () use ($method) { |
|
| 405 | + $router->addRoute('/route-to-clear/', function() use ($method) { |
|
| 406 | 406 | return $method; |
| 407 | 407 | }, $method); |
| 408 | 408 | $router->clear(); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $_SERVER['REQUEST_METHOD'] = $method; |
| 429 | 429 | |
| 430 | 430 | $router = new \Mezon\Router\Router(); |
| 431 | - $router->addRoute('/catalog/', function ($route) { |
|
| 431 | + $router->addRoute('/catalog/', function($route) { |
|
| 432 | 432 | return $route; |
| 433 | 433 | }, $method); |
| 434 | 434 | |
@@ -444,10 +444,10 @@ discard block |
||
| 444 | 444 | { |
| 445 | 445 | // setup |
| 446 | 446 | $router = new \Mezon\Router\Router(); |
| 447 | - $router->addRoute('/searching-static-route/', function (string $route) { |
|
| 447 | + $router->addRoute('/searching-static-route/', function(string $route) { |
|
| 448 | 448 | return $route; |
| 449 | 449 | }); |
| 450 | - $router->addRoute('/searching-param-route/[i:id]/', function (string $route) { |
|
| 450 | + $router->addRoute('/searching-param-route/[i:id]/', function(string $route) { |
|
| 451 | 451 | return $route; |
| 452 | 452 | }); |
| 453 | 453 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | // setup |
| 27 | 27 | $router = new \Mezon\Router\Router(); |
| 28 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 28 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 29 | 29 | // do nothing |
| 30 | 30 | }); |
| 31 | 31 | |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | $router = new \Mezon\Router\Router(); |
| 177 | 177 | $router->addType('date', DateRouterType::class); |
| 178 | 178 | if (is_string($pattern)) { |
| 179 | - $router->addRoute($pattern, function () { |
|
| 179 | + $router->addRoute($pattern, function() { |
|
| 180 | 180 | // do nothing |
| 181 | 181 | }, $method); |
| 182 | 182 | } else { |
| 183 | 183 | foreach ($pattern as $r) { |
| 184 | - $router->addRoute($r, function () { |
|
| 184 | + $router->addRoute($r, function() { |
|
| 185 | 185 | // do nothing |
| 186 | 186 | }, $method); |
| 187 | 187 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function testValidExtractedParameter(): void |
| 199 | 199 | { |
| 200 | 200 | $router = new \Mezon\Router\Router(); |
| 201 | - $router->addRoute('/catalog/[a:cat_id]/', function ($route, $parameters) { |
|
| 201 | + $router->addRoute('/catalog/[a:cat_id]/', function($route, $parameters) { |
|
| 202 | 202 | return $parameters['cat_id']; |
| 203 | 203 | }); |
| 204 | 204 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $router = new \Mezon\Router\Router(); |
| 216 | 216 | $router->addRoute( |
| 217 | 217 | '/catalog/[a:cat_id]/[i:item_id]', |
| 218 | - function ($route, $parameters) { |
|
| 218 | + function($route, $parameters) { |
|
| 219 | 219 | return $parameters['cat_id'] . $parameters['item_id']; |
| 220 | 220 | }); |
| 221 | 221 | |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | public function testValidRouteParameter(): void |
| 231 | 231 | { |
| 232 | 232 | $router = new \Mezon\Router\Router(); |
| 233 | - $router->addRoute('/catalog/all/', function ($route) { |
|
| 233 | + $router->addRoute('/catalog/all/', function($route) { |
|
| 234 | 234 | return $route; |
| 235 | 235 | }); |
| 236 | - $router->addRoute('/catalog/[i:cat_id]', function ($route) { |
|
| 236 | + $router->addRoute('/catalog/[i:cat_id]', function($route) { |
|
| 237 | 237 | return $route; |
| 238 | 238 | }); |
| 239 | 239 | |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | // setup |
| 260 | 260 | $router = new Router(); |
| 261 | - for ($i = 0; $i < 15; $i ++) { |
|
| 262 | - $router->addRoute('/multiple/' . $i . '/[i:id]', function () { |
|
| 261 | + for ($i = 0; $i < 15; $i++) { |
|
| 262 | + $router->addRoute('/multiple/' . $i . '/[i:id]', function() { |
|
| 263 | 263 | return 'done!'; |
| 264 | 264 | }); |
| 265 | 265 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $return = ''; |
| 52 | 52 | |
| 53 | - for ($n = 0; $n < $i; $n ++) { |
|
| 53 | + for ($n = 0; $n < $i; $n++) { |
|
| 54 | 54 | $return .= '()'; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $bunch['regexp'] = ''; |
| 68 | 68 | |
| 69 | - if (! empty($bunch['bunch'])) { |
|
| 69 | + if (!empty($bunch['bunch'])) { |
|
| 70 | 70 | $items = []; |
| 71 | 71 | |
| 72 | 72 | foreach ($bunch['bunch'] as $i => $route) { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | protected function compileRegexpForBunches(): void |
| 90 | 90 | { |
| 91 | - if (! $this->regExpsWereCompiled) { |
|
| 91 | + if (!$this->regExpsWereCompiled) { |
|
| 92 | 92 | foreach (self::getListOfSupportedRequestMethods() as $requestMethod) { |
| 93 | 93 | foreach ($this->paramRoutes[$requestMethod] as &$bunch) { |
| 94 | 94 | $this->compileRegexpForBunch($bunch); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $this->paramRoutes[$requestMethod][] = [ |
| 125 | 125 | 'bunch' => [] |
| 126 | 126 | ]; |
| 127 | - $bunchCursor ++; |
|
| 127 | + $bunchCursor++; |
|
| 128 | 128 | $lastBunchSize = 0; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | foreach (self::getListOfSupportedRequestMethods() as $requestMethod) { |
| 258 | 258 | $trace[] = $requestMethod . ' : '; |
| 259 | - if (! empty($this->staticRoutes[$requestMethod])) { |
|
| 259 | + if (!empty($this->staticRoutes[$requestMethod])) { |
|
| 260 | 260 | $trace[] = implode(', ', array_keys($this->staticRoutes[$requestMethod])); |
| 261 | 261 | $trace[] = ', '; |
| 262 | 262 | } |
| 263 | - if (! empty($this->paramRoutes[$requestMethod])) { |
|
| 263 | + if (!empty($this->paramRoutes[$requestMethod])) { |
|
| 264 | 264 | foreach ($this->paramRoutes[$requestMethod] as $bunch) { |
| 265 | 265 | $items = []; |
| 266 | 266 | foreach ($bunch['bunch'] as $item) { |