@@ -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 | } |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | // setup |
| 24 | 24 | $router = new \Mezon\Router\Router(); |
| 25 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 25 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 26 | 26 | // do nothing |
| 27 | 27 | }); |
| 28 | 28 | |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | // setup |
| 123 | 123 | $router = new \Mezon\Router\Router(); |
| 124 | 124 | if (is_string($pattern)) { |
| 125 | - $router->addRoute($pattern, function () { |
|
| 125 | + $router->addRoute($pattern, function() { |
|
| 126 | 126 | // do nothing |
| 127 | 127 | }); |
| 128 | 128 | } else { |
| 129 | 129 | foreach ($pattern as $r) { |
| 130 | - $router->addRoute($r, function () { |
|
| 130 | + $router->addRoute($r, function() { |
|
| 131 | 131 | // do nothing |
| 132 | 132 | }); |
| 133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $_SERVER['REQUEST_METHOD'] = 'DELETE'; |
| 147 | 147 | |
| 148 | 148 | $router = new \Mezon\Router\Router(); |
| 149 | - $router->addRoute('/catalog/[i:cat_id]', function ($route) { |
|
| 149 | + $router->addRoute('/catalog/[i:cat_id]', function($route) { |
|
| 150 | 150 | return $route; |
| 151 | 151 | }, 'DELETE'); |
| 152 | 152 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $_SERVER['REQUEST_METHOD'] = 'PUT'; |
| 164 | 164 | |
| 165 | 165 | $router = new \Mezon\Router\Router(); |
| 166 | - $router->addRoute('/catalog/[i:cat_id]', function ($route) { |
|
| 166 | + $router->addRoute('/catalog/[i:cat_id]', function($route) { |
|
| 167 | 167 | return $route; |
| 168 | 168 | }, 'PUT'); |
| 169 | 169 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $_SERVER['REQUEST_METHOD'] = 'POST'; |
| 181 | 181 | |
| 182 | 182 | $router = new \Mezon\Router\Router(); |
| 183 | - $router->addRoute('/catalog/[i:cat_id]', function ($route) { |
|
| 183 | + $router->addRoute('/catalog/[i:cat_id]', function($route) { |
|
| 184 | 184 | return $route; |
| 185 | 185 | }, 'POST'); |
| 186 | 186 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | public function testValidExtractedParameter(): void |
| 349 | 349 | { |
| 350 | 350 | $router = new \Mezon\Router\Router(); |
| 351 | - $router->addRoute('/catalog/[a:cat_id]/', function ($route, $parameters) { |
|
| 351 | + $router->addRoute('/catalog/[a:cat_id]/', function($route, $parameters) { |
|
| 352 | 352 | return $parameters['cat_id']; |
| 353 | 353 | }); |
| 354 | 354 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | $router = new \Mezon\Router\Router(); |
| 366 | 366 | $router->addRoute( |
| 367 | 367 | '/catalog/[a:cat_id]/[i:item_id]', |
| 368 | - function ($route, $parameters) { |
|
| 368 | + function($route, $parameters) { |
|
| 369 | 369 | return $parameters['cat_id'] . $parameters['item_id']; |
| 370 | 370 | }); |
| 371 | 371 | |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | public function testValidRouteParameter(): void |
| 381 | 381 | { |
| 382 | 382 | $router = new \Mezon\Router\Router(); |
| 383 | - $router->addRoute('/catalog/all/', function ($route) { |
|
| 383 | + $router->addRoute('/catalog/all/', function($route) { |
|
| 384 | 384 | return $route; |
| 385 | 385 | }); |
| 386 | - $router->addRoute('/catalog/[i:cat_id]', function ($route) { |
|
| 386 | + $router->addRoute('/catalog/[i:cat_id]', function($route) { |
|
| 387 | 387 | return $route; |
| 388 | 388 | }); |
| 389 | 389 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | // setup |
| 24 | 24 | $router = new \Mezon\Router\Router(); |
| 25 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 25 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 26 | 26 | // do nothing |
| 27 | 27 | }); |
| 28 | 28 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | // setup |
| 43 | 43 | $_SERVER['REQUEST_METHOD'] = 'HEAD'; |
| 44 | 44 | $router = new \Mezon\Router\Router(); |
| 45 | - $router->addRoute('/catalog/[i:foo]/', function () { |
|
| 45 | + $router->addRoute('/catalog/[i:foo]/', function() { |
|
| 46 | 46 | // do nothing |
| 47 | 47 | }); |
| 48 | 48 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $router = new \Mezon\Router\Router(); |
| 63 | 63 | $router->addRoute('/catalog/[il:cat_id]/', [ |
| 64 | 64 | $this, |
| 65 | - function () {return 1;} |
|
| 65 | + function() {return 1; } |
|
| 66 | 66 | ]); |
| 67 | 67 | |
| 68 | 68 | // assertion |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $router = new \Mezon\Router\Router(); |
| 85 | 85 | $router->addRoute('/catalog/[i:cat_id]', [ |
| 86 | 86 | $this, |
| 87 | - function () {return 1;} |
|
| 87 | + function() {return 1; } |
|
| 88 | 88 | ]); |
| 89 | 89 | |
| 90 | 90 | try { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $router = new \Mezon\Router\Router(); |
| 110 | 110 | $router->addRoute('/catalog/[i:cat_id]', [ |
| 111 | 111 | $this, |
| 112 | - function () {return 1;} |
|
| 112 | + function() {return 1; } |
|
| 113 | 113 | ]); |
| 114 | 114 | |
| 115 | 115 | try { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $router = new \Mezon\Router\Router(); |
| 135 | 135 | $router->addRoute('/catalog/[i:item_id]', [ |
| 136 | 136 | $this, |
| 137 | - function () {return 1;} |
|
| 137 | + function() {return 1; } |
|
| 138 | 138 | ]); |
| 139 | 139 | |
| 140 | 140 | try { |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | // setup |
| 178 | 178 | $router = new \Mezon\Router\Router(); |
| 179 | - $router->addRoute($route, function () { |
|
| 179 | + $router->addRoute($route, function() { |
|
| 180 | 180 | // do nothing |
| 181 | 181 | }); |
| 182 | 182 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $router = new \Mezon\Router\Router(); |
| 196 | 196 | $router->addRoute('/catalog/[unexisting-type:i]/item/', [ |
| 197 | 197 | $this, |
| 198 | - function () {return 1;} |
|
| 198 | + function() {return 1; } |
|
| 199 | 199 | ]); |
| 200 | 200 | |
| 201 | 201 | try { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $router = new \Mezon\Router\Router(); |
| 215 | 215 | $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', [ |
| 216 | 216 | $this, |
| 217 | - function () {return 1;} |
|
| 217 | + function() {return 1; } |
|
| 218 | 218 | ]); |
| 219 | 219 | |
| 220 | 220 | try { |