@@ -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 | /** |
@@ -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 { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | // setup |
39 | 39 | $router = new Router(); |
40 | - $router->addRoute($route, function () { |
|
40 | + $router->addRoute($route, function() { |
|
41 | 41 | return 'route result'; |
42 | 42 | }); |
43 | 43 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | // setup |
57 | 57 | $router = new Router(); |
58 | - $router->addRoute('existing-route', function () { |
|
58 | + $router->addRoute('existing-route', function() { |
|
59 | 59 | return 'existing route result'; |
60 | 60 | }); |
61 | 61 |