Passed
Push — master ( 0586a9...fc3336 )
by Alex
02:33
created
Mezon/Router/Tests/StaticRoutesUnitTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/DynamicRoutesUnitTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
         $router = new \Mezon\Router\Router();
159 159
         $router->addType('date', DateRouterType::class);
160 160
         if (is_string($pattern)) {
161
-            $router->addRoute($pattern, function () {
161
+            $router->addRoute($pattern, function() {
162 162
                 // do nothing
163 163
             }, $method);
164 164
         } else {
165 165
             foreach ($pattern as $r) {
166
-                $router->addRoute($r, function () {
166
+                $router->addRoute($r, function() {
167 167
                     // do nothing
168 168
                 }, $method);
169 169
             }
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
     {
182 182
         // setup
183 183
         $router = new Router();
184
-        for ($i = 0; $i < 15; $i ++) {
185
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
184
+        for ($i = 0; $i < 15; $i++) {
185
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
186 186
                 return 'done!';
187 187
             });
188 188
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/ExtractParametersUnitTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         // setup
26 26
         $router = new \Mezon\Router\Router();
27
-        $router->addRoute('/catalog/[i:foo]/', function () {
27
+        $router->addRoute('/catalog/[i:foo]/', function() {
28 28
             // do nothing
29 29
         });
30 30
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function testValidExtractedParameter(): void
42 42
     {
43 43
         $router = new \Mezon\Router\Router();
44
-        $router->addRoute('/catalog/[a:cat_id]/', function ($route, $parameters) {
44
+        $router->addRoute('/catalog/[a:cat_id]/', function($route, $parameters) {
45 45
             return $parameters['cat_id'];
46 46
         });
47 47
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $router = new \Mezon\Router\Router();
59 59
         $router->addRoute(
60 60
             '/catalog/[a:cat_id]/[i:item_id]',
61
-            function ($route, $parameters) {
61
+            function($route, $parameters) {
62 62
                 return $parameters['cat_id'] . $parameters['item_id'];
63 63
             });
64 64
 
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
     public function testValidRouteParameter(): void
74 74
     {
75 75
         $router = new \Mezon\Router\Router();
76
-        $router->addRoute('/catalog/all/', function ($route) {
76
+        $router->addRoute('/catalog/all/', function($route) {
77 77
             return $route;
78 78
         });
79
-        $router->addRoute('/catalog/[i:cat_id]', function ($route) {
79
+        $router->addRoute('/catalog/[i:cat_id]', function($route) {
80 80
             return $route;
81 81
         });
82 82
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
     {
102 102
         // setup
103 103
         $router = new Router();
104
-        for ($i = 0; $i < 15; $i ++) {
105
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
104
+        for ($i = 0; $i < 15; $i++) {
105
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
106 106
                 return 'done!';
107 107
             });
108 108
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/MiddlewareUnitTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
         // setup
27 27
         $route = '/route-with-middleware/';
28 28
         $router = new Router();
29
-        $router->registerMiddleware('*', function () {
29
+        $router->registerMiddleware('*', function() {
30 30
             return [
31 31
                 1,
32 32
                 2
33 33
             ];
34 34
         });
35
-        $router->addRoute($route, function (int $i, int $j) {
35
+        $router->addRoute($route, function(int $i, int $j) {
36 36
             return [
37 37
                 $i,
38 38
                 $j
39 39
             ];
40 40
         });
41
-        $router->registerMiddleware($route, function (int $i, int $j) {
41
+        $router->registerMiddleware($route, function(int $i, int $j) {
42 42
             return [
43 43
                 $i,
44 44
                 $j
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         $route = '/route/[i:id]';
63 63
         $router = new Router();
64 64
 
65
-        $router->addRoute($route, function (string $route, $parameters) {
65
+        $router->addRoute($route, function(string $route, $parameters) {
66 66
             return $parameters;
67 67
         });
68 68
 
69
-        $router->registerMiddleware($route, function (string $route, array $parameters) {
69
+        $router->registerMiddleware($route, function(string $route, array $parameters) {
70 70
             $parameters['_second'] = $parameters['id'];
71 71
             $parameters['id'] += 9;
72 72
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
         });
78 78
 
79 79
         // This middleware is broken, don't parse the result
80
-        $router->registerMiddleware($route, function (string $route, array $parameters) {
80
+        $router->registerMiddleware($route, function(string $route, array $parameters) {
81 81
             $parameters['_dont_set_this'] = true;
82 82
 
83 83
             return null;
84 84
         });
85 85
 
86
-        $router->registerMiddleware($route, function (string $route, array $parameters) {
86
+        $router->registerMiddleware($route, function(string $route, array $parameters) {
87 87
             $parameters['_third'] = $parameters['id'];
88 88
             $parameters['id'] *= 2;
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             ];
94 94
         });
95 95
 
96
-        $router->registerMiddleware('*', function (string $route, array $parameters) {
96
+        $router->registerMiddleware('*', function(string $route, array $parameters) {
97 97
             $parameters['_first'] = $parameters['id'];
98 98
             $parameters['id'] *= 2;
99 99
 
Please login to merge, or discard this patch.
Mezon/Router/UrlParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $routerTrimmed = trim($router, '/');
260 260
 
261
-        if (! isset($this->middleware[$routerTrimmed])) {
261
+        if (!isset($this->middleware[$routerTrimmed])) {
262 262
             $this->middleware[$routerTrimmed] = [];
263 263
         }
264 264
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             $this->parameters
290 290
         ];
291 291
 
292
-        if (! count($middleWares)) {
292
+        if (!count($middleWares)) {
293 293
             return $result;
294 294
         }
295 295
 
Please login to merge, or discard this patch.
Mezon/Router/Router.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
      */
108 108
     public function callRoute($route)
109 109
     {
110
-        if (! $this->regExpsWereCompiled) {
110
+        if (!$this->regExpsWereCompiled) {
111 111
             $this->compileRegexpForBunches();
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/UniversalRouteUnitTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,23 +46,23 @@
 block discarded – undo
46 46
      */
47 47
     public function universalRouteDataProvider(): array
48 48
     {
49
-        $setup = function () {
49
+        $setup = function() {
50 50
             return [
51 51
                 [
52 52
                     '/hello/[s:name]/',
53
-                    function () {
53
+                    function() {
54 54
                         return 'hello';
55 55
                     }
56 56
                 ],
57 57
                 [
58 58
                     '*',
59
-                    function () {
59
+                    function() {
60 60
                         return 'universal';
61 61
                     }
62 62
                 ],
63 63
                 [
64 64
                     '/bye/[s:name]/',
65
-                    function () {
65
+                    function() {
66 66
                         return 'bye';
67 67
                     }
68 68
                 ]
Please login to merge, or discard this patch.
Mezon/Router/RoutesSet.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     protected function compileRegexpForBunch(array &$bunch): void
66 66
     {
67
-        if (! empty($bunch['bunch'])) {
67
+        if (!empty($bunch['bunch'])) {
68 68
             $bunch['regexp'] = '';
69 69
             $hashTable = [];
70 70
             $items = [];
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected function compileRegexpForBunches(): void
102 102
     {
103
-        if (! $this->regExpsWereCompiled) {
103
+        if (!$this->regExpsWereCompiled) {
104 104
             foreach (self::getListOfSupportedRequestMethods() as $requestMethod) {
105 105
                 foreach ($this->paramRoutes[$requestMethod] as &$bunch) {
106 106
                     $this->compileRegexpForBunch($bunch);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $this->paramRoutes[$requestMethod][] = [
137 137
                 'bunch' => []
138 138
             ];
139
-            $bunchCursor ++;
139
+            $bunchCursor++;
140 140
             $lastBunchSize = 0;
141 141
         }
142 142
 
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
                 $requestMethod . ' : '
263 263
             ];
264 264
             $hasRoutes = false;
265
-            if (! empty($this->staticRoutes[$requestMethod])) {
265
+            if (!empty($this->staticRoutes[$requestMethod])) {
266 266
                 $trace[] = implode(', ', array_keys($this->staticRoutes[$requestMethod]));
267 267
                 $trace[] = ', ';
268 268
                 $hasRoutes = true;
269 269
             }
270
-            if (! empty($this->paramRoutes[$requestMethod])) {
270
+            if (!empty($this->paramRoutes[$requestMethod])) {
271 271
                 foreach ($this->paramRoutes[$requestMethod] as $bunch) {
272 272
                     $items = [];
273 273
                     foreach ($bunch['bunch'] as $item) {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 }
279 279
             }
280 280
 
281
-            if (! $hasRoutes) {
281
+            if (!$hasRoutes) {
282 282
                 $trace[] = '<none>';
283 283
             }
284 284
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/GetCallbackUnitTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // setup
45 45
         RouterUnitTest::setRequestMethod('GET');
46 46
         $router = new Router();
47
-        $router->addRoute($route, function () {
47
+        $router->addRoute($route, function() {
48 48
             return 'route result';
49 49
         });
50 50
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         // setup
64 64
         $router = new Router();
65
-        $router->addRoute('existing-route', function () {
65
+        $router->addRoute('existing-route', function() {
66 66
             return 'existing route result';
67 67
         });
68 68
 
Please login to merge, or discard this patch.