@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $methodName[0] = strtolower($methodName[0]); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - for ($i = 1; $i < strlen($methodName); $i ++) { |
|
| 35 | + for ($i = 1; $i < strlen($methodName); $i++) { |
|
| 36 | 36 | if (ctype_upper($methodName[$i])) { |
| 37 | 37 | $methodName = substr_replace($methodName, '-' . strtolower($methodName[$i]), $i, 1); |
| 38 | 38 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $router = new \Mezon\Router\Router(); |
| 83 | 83 | |
| 84 | - $router->addRoute('/one-comonent-lambda/', function () { |
|
| 84 | + $router->addRoute('/one-comonent-lambda/', function() { |
|
| 85 | 85 | return 'Hello world!'; |
| 86 | 86 | }); |
| 87 | 87 | |
@@ -176,16 +176,16 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $route = '/catalog/'; |
| 178 | 178 | $router = new \Mezon\Router\Router(); |
| 179 | - $router->addRoute($route, function () { |
|
| 179 | + $router->addRoute($route, function() { |
|
| 180 | 180 | return 'POST'; |
| 181 | 181 | }, 'POST'); |
| 182 | - $router->addRoute($route, function () { |
|
| 182 | + $router->addRoute($route, function() { |
|
| 183 | 183 | return 'GET'; |
| 184 | 184 | }, 'GET'); |
| 185 | - $router->addRoute($route, function () { |
|
| 185 | + $router->addRoute($route, function() { |
|
| 186 | 186 | return 'PUT'; |
| 187 | 187 | }, 'PUT'); |
| 188 | - $router->addRoute($route, function () { |
|
| 188 | + $router->addRoute($route, function() { |
|
| 189 | 189 | return RouterUnitTest::DELETE_REQUEST_METHOD; |
| 190 | 190 | }, RouterUnitTest::DELETE_REQUEST_METHOD); |
| 191 | 191 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | public function testClearMethod(string $method): void |
| 244 | 244 | { |
| 245 | 245 | $router = new \Mezon\Router\Router(); |
| 246 | - $router->addRoute('/route-to-clear/', function () use ($method) { |
|
| 246 | + $router->addRoute('/route-to-clear/', function() use ($method) { |
|
| 247 | 247 | return $method; |
| 248 | 248 | }, $method); |
| 249 | 249 | $router->clear(); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | { |
| 274 | 274 | // setup |
| 275 | 275 | $router = new \Mezon\Router\Router(); |
| 276 | - $router->setNoProcessorFoundErrorHandler(function () { |
|
| 276 | + $router->setNoProcessorFoundErrorHandler(function() { |
|
| 277 | 277 | $this->errorHandler(); |
| 278 | 278 | }); |
| 279 | 279 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | { |
| 315 | 315 | // setup |
| 316 | 316 | $router = new \Mezon\Router\Router(); |
| 317 | - $router->addRoute($route, function () { |
|
| 317 | + $router->addRoute($route, function() { |
|
| 318 | 318 | return 'route result'; |
| 319 | 319 | }); |
| 320 | 320 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | // setup |
| 334 | 334 | $router = new \Mezon\Router\Router(); |
| 335 | - $router->addRoute('existing-route', function () { |
|
| 335 | + $router->addRoute('existing-route', function() { |
|
| 336 | 336 | return 'existing route result'; |
| 337 | 337 | }); |
| 338 | 338 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | { |
| 394 | 394 | // setup |
| 395 | 395 | $router = new \Mezon\Router\Router(); |
| 396 | - $router->addRoute($route, function () { |
|
| 396 | + $router->addRoute($route, function() { |
|
| 397 | 397 | return 'named route result'; |
| 398 | 398 | }, 'GET', 'named-route'); |
| 399 | 399 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function searchRegExp(): string |
| 18 | 18 | { |
| 19 | - return '(\[fp:'.BaseType::PARAMETER_NAME_REGEXP.'+\])'; |
|
| 19 | + return '(\[fp:' . BaseType::PARAMETER_NAME_REGEXP . '+\])'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function searchRegExp(): string |
| 18 | 18 | { |
| 19 | - return '(\[s:'.BaseType::PARAMETER_NAME_REGEXP.'\])'; |
|
| 19 | + return '(\[s:' . BaseType::PARAMETER_NAME_REGEXP . '\])'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function searchRegExp(): string |
| 18 | 18 | { |
| 19 | - return '(\[il:'.BaseType::PARAMETER_NAME_REGEXP.'\])'; |
|
| 19 | + return '(\[il:' . BaseType::PARAMETER_NAME_REGEXP . '\])'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function searchRegExp(): string |
| 18 | 18 | { |
| 19 | - return '(\[a:'.BaseType::PARAMETER_NAME_REGEXP.'\])'; |
|
| 19 | + return '(\[a:' . BaseType::PARAMETER_NAME_REGEXP . '\])'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public static function searchRegExp(): string |
| 18 | 18 | { |
| 19 | - return '(\[i:'.BaseType::PARAMETER_NAME_REGEXP.'+\])'; |
|
| 19 | + return '(\[i:' . BaseType::PARAMETER_NAME_REGEXP . '+\])'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function testArrayRoutes(): void |
| 220 | 220 | { |
| 221 | 221 | $router = new \Mezon\Router\Router(); |
| 222 | - $router->addRoute('/part1/part2/', function ($route) { |
|
| 222 | + $router->addRoute('/part1/part2/', function($route) { |
|
| 223 | 223 | return $route; |
| 224 | 224 | }, 'GET'); |
| 225 | 225 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $this->setRequestUri('/catalog/item/'); |
| 240 | 240 | |
| 241 | 241 | $router = new \Mezon\Router\Router(); |
| 242 | - $router->addRoute('/catalog/item/', function ($route) { |
|
| 242 | + $router->addRoute('/catalog/item/', function($route) { |
|
| 243 | 243 | return $route; |
| 244 | 244 | }, 'GET'); |
| 245 | 245 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $this->setRequestUri('/'); |
| 259 | 259 | |
| 260 | 260 | $router = new \Mezon\Router\Router(); |
| 261 | - $router->addRoute('/index/', function ($route) { |
|
| 261 | + $router->addRoute('/index/', function($route) { |
|
| 262 | 262 | return $route; |
| 263 | 263 | }, 'GET'); |
| 264 | 264 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $this->setRequestUri('/'); |
| 279 | 279 | |
| 280 | 280 | $router = new \Mezon\Router\Router(); |
| 281 | - $router->addRoute('/index/', function ($route) { |
|
| 281 | + $router->addRoute('/index/', function($route) { |
|
| 282 | 282 | return $route; |
| 283 | 283 | }, [ |
| 284 | 284 | 'GET', |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $_SERVER['REQUEST_METHOD'] = RouterUnitTest::DELETE_REQUEST_METHOD; |
| 331 | 331 | |
| 332 | 332 | $router = new \Mezon\Router\Router(); |
| 333 | - $router->addRoute('/static-delete-existing/', function ($route) { |
|
| 333 | + $router->addRoute('/static-delete-existing/', function($route) { |
|
| 334 | 334 | return $route; |
| 335 | 335 | }, RouterUnitTest::DELETE_REQUEST_METHOD); |
| 336 | 336 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $_SERVER['REQUEST_METHOD'] = 'PUT'; |
| 373 | 373 | |
| 374 | 374 | $router = new \Mezon\Router\Router(); |
| 375 | - $router->addRoute('/static-put-existing/', function ($route) { |
|
| 375 | + $router->addRoute('/static-put-existing/', function($route) { |
|
| 376 | 376 | return $route; |
| 377 | 377 | }, 'PUT'); |
| 378 | 378 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $_SERVER['REQUEST_METHOD'] = 'POST'; |
| 415 | 415 | |
| 416 | 416 | $router = new \Mezon\Router\Router(); |
| 417 | - $router->addRoute('/catalog/', function ($route) { |
|
| 417 | + $router->addRoute('/catalog/', function($route) { |
|
| 418 | 418 | return $route; |
| 419 | 419 | }, 'POST'); |
| 420 | 420 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | // setup |
| 432 | 432 | $router = new \Mezon\Router\Router(); |
| 433 | - $router->addRoute('/searching-route/', function (string $route) { |
|
| 433 | + $router->addRoute('/searching-route/', function(string $route) { |
|
| 434 | 434 | return $route; |
| 435 | 435 | }); |
| 436 | 436 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | // setup |
| 34 | 34 | $router = new \Mezon\Router\Router(); |
| 35 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 35 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 36 | 36 | // do nothing |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // setup |
| 53 | 53 | $_SERVER['REQUEST_METHOD'] = 'HEAD'; |
| 54 | 54 | $router = new \Mezon\Router\Router(); |
| 55 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 55 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 56 | 56 | // do nothing |
| 57 | 57 | }); |
| 58 | 58 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | // setup |
| 188 | 188 | $router = new \Mezon\Router\Router(); |
| 189 | - $router->addRoute($route, function () { |
|
| 189 | + $router->addRoute($route, function() { |
|
| 190 | 190 | // do nothing |
| 191 | 191 | }); |
| 192 | 192 | |