Passed
Push — master ( b3b855...2c7091 )
by Alex
08:59 queued 06:42
created
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/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.
Mezon/Router/Tests/BigSetOfRoutesUnitTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
         // setup
37 37
         RouterUnitTest::setRequestMethod('GET');
38 38
         $router = new Router();
39
-        for ($i = 1; $i <= $amount; $i ++) {
40
-            $router->addRoute('/param/[i:id]/' . $i, function () use ($i): int {
39
+        for ($i = 1; $i <= $amount; $i++) {
40
+            $router->addRoute('/param/[i:id]/' . $i, function() use ($i): int {
41 41
                 return $i;
42 42
             });
43 43
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/DynamicRoutesUnitTest.php 1 patch
Spacing   +10 added lines, -10 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
         }
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
     {
203 203
         // setup
204 204
         $router = new Router();
205
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function () {
205
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function() {
206 206
             return 'get-custom-field';
207 207
         });
208
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function () {
208
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function() {
209 209
             return 'add-custom-field';
210 210
         });
211
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function () {
211
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function() {
212 212
             return 'delete-custom-field';
213 213
         });
214
-        $router->addRoute('/restore-password/[s:token]', function () {
214
+        $router->addRoute('/restore-password/[s:token]', function() {
215 215
             return 'restore-password';
216 216
         });
217
-        $router->addRoute('/reset-password/[s:token]', function () {
217
+        $router->addRoute('/reset-password/[s:token]', function() {
218 218
             return 'reset-password';
219 219
         });
220
-        $router->addRoute('/user/[s:login]/delete', function () {
220
+        $router->addRoute('/user/[s:login]/delete', function() {
221 221
             return 'user-delete';
222 222
         });
223 223
 
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
@@ -50,23 +50,23 @@
 block discarded – undo
50 50
      */
51 51
     public function universalRouteDataProvider(): array
52 52
     {
53
-        $setup = function (): array {
53
+        $setup = function(): array {
54 54
             return [
55 55
                 [
56 56
                     '/hello/[s:name]/',
57
-                    function () {
57
+                    function() {
58 58
                         return 'hello';
59 59
                     }
60 60
                 ],
61 61
                 [
62 62
                     '*',
63
-                    function () {
63
+                    function() {
64 64
                         return 'universal';
65 65
                     }
66 66
                 ],
67 67
                 [
68 68
                     '/bye/[s:name]/',
69
-                    function () {
69
+                    function() {
70 70
                         return 'bye';
71 71
                     }
72 72
                 ]
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
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
         // setup
31 31
         $route = '/route-with-middleware/';
32 32
         $router = new Router();
33
-        $router->registerMiddleware('*', function () {
33
+        $router->registerMiddleware('*', function() {
34 34
             return [
35 35
                 1,
36 36
                 2
37 37
             ];
38 38
         });
39
-        $router->addRoute($route, function (int $i, int $j) {
39
+        $router->addRoute($route, function(int $i, int $j) {
40 40
             return [
41 41
                 $i,
42 42
                 $j
43 43
             ];
44 44
         });
45
-        $router->registerMiddleware($route, function (int $i, int $j) {
45
+        $router->registerMiddleware($route, function(int $i, int $j) {
46 46
             return [
47 47
                 $i,
48 48
                 $j
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         $route = '/route/[i:id]';
67 67
         $router = new Router();
68 68
 
69
-        $router->addRoute($route, function (string $route, array $parameters): array {
69
+        $router->addRoute($route, function(string $route, array $parameters): array {
70 70
             return $parameters;
71 71
         });
72 72
 
73 73
         $router->registerMiddleware(
74 74
             $route,
75
-            function (string $route, array $parameters) {
75
+            function(string $route, array $parameters) {
76 76
                 $parameters['_second'] = $parameters['id'];
77 77
                 $parameters['id'] += 9;
78 78
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         // This middleware is broken, don't parse the result
86 86
         $router->registerMiddleware(
87 87
             $route,
88
-            function (string $route, array $parameters) {
88
+            function(string $route, array $parameters) {
89 89
                 $parameters['_dont_set_this'] = true;
90 90
 
91 91
                 return null;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         $router->registerMiddleware(
95 95
             $route,
96
-            function (string $route, array $parameters) {
96
+            function(string $route, array $parameters) {
97 97
                 $parameters['_third'] = $parameters['id'];
98 98
                 $parameters['id'] *= 2;
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         $router->registerMiddleware(
107 107
             '*',
108
-            function (string $route, array $parameters) {
108
+            function(string $route, array $parameters) {
109 109
                 $parameters['_first'] = $parameters['id'];
110 110
                 $parameters['id'] *= 2;
111 111
 
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
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     {
29 29
         // setup
30 30
         $router = new \Mezon\Router\Router();
31
-        $router->addRoute('/catalog/[i:foo]/', function (): void {
31
+        $router->addRoute('/catalog/[i:foo]/', function(): void {
32 32
             // do nothing
33 33
         });
34 34
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $router = new \Mezon\Router\Router();
48 48
         $router->addRoute(
49 49
             '/catalog/[a:cat_id]/',
50
-            function (string $route, array $parameters): string {
50
+            function(string $route, array $parameters): string {
51 51
                 return $parameters['cat_id'];
52 52
             });
53 53
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $router = new \Mezon\Router\Router();
65 65
         $router->addRoute(
66 66
             '/catalog/[a:cat_id]/[i:item_id]',
67
-            function (string $route, array $parameters): string {
67
+            function(string $route, array $parameters): string {
68 68
                 return $parameters['cat_id'] . $parameters['item_id'];
69 69
             });
70 70
 
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
     public function testValidRouteParameter(): void
80 80
     {
81 81
         $router = new \Mezon\Router\Router();
82
-        $router->addRoute('/catalog/all/', function (string $route): string {
82
+        $router->addRoute('/catalog/all/', function(string $route): string {
83 83
             return $route;
84 84
         });
85
-        $router->addRoute('/catalog/[i:cat_id]', function (string $route): string {
85
+        $router->addRoute('/catalog/[i:cat_id]', function(string $route): string {
86 86
             return $route;
87 87
         });
88 88
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     {
108 108
         // setup
109 109
         $router = new Router();
110
-        for ($i = 0; $i < 15; $i ++) {
111
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
110
+        for ($i = 0; $i < 15; $i++) {
111
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
112 112
                 return 'done!';
113 113
             });
114 114
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/StaticRoutesUnitTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function testArrayRoutes(): void
97 97
     {
98 98
         $router = new \Mezon\Router\Router();
99
-        $router->addRoute('/part1/part2/', function (string $route): string {
99
+        $router->addRoute('/part1/part2/', function(string $route): string {
100 100
             return $route;
101 101
         }, 'GET');
102 102
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $this->setRequestUri('/catalog/item/');
117 117
 
118 118
         $router = new \Mezon\Router\Router();
119
-        $router->addRoute('/catalog/item/', function (string $route): string {
119
+        $router->addRoute('/catalog/item/', function(string $route): string {
120 120
             return $route;
121 121
         }, 'GET');
122 122
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $this->setRequestUri('/');
136 136
 
137 137
         $router = new \Mezon\Router\Router();
138
-        $router->addRoute('/index/', function (string $route): string {
138
+        $router->addRoute('/index/', function(string $route): string {
139 139
             return $route;
140 140
         }, 'GET');
141 141
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $this->setRequestUri('/');
156 156
 
157 157
         $router = new \Mezon\Router\Router();
158
-        $router->addRoute('/index/', function (string $route): string {
158
+        $router->addRoute('/index/', function(string $route): string {
159 159
             return $route;
160 160
         }, [
161 161
             'GET',
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     public function testClearMethod(string $method): void
278 278
     {
279 279
         $router = new \Mezon\Router\Router();
280
-        $router->addRoute('/route-to-clear/', function () use ($method) {
280
+        $router->addRoute('/route-to-clear/', function() use ($method) {
281 281
             return $method;
282 282
         }, $method);
283 283
         $router->clear();
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         $_SERVER['REQUEST_METHOD'] = $method;
304 304
 
305 305
         $router = new \Mezon\Router\Router();
306
-        $router->addRoute('/catalog/', function (string $route): string {
306
+        $router->addRoute('/catalog/', function(string $route): string {
307 307
             return $route;
308 308
         }, $method);
309 309
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
     {
320 320
         // setup
321 321
         $router = new \Mezon\Router\Router();
322
-        $router->addRoute('/searching-static-route/', function (string $route) {
322
+        $router->addRoute('/searching-static-route/', function(string $route) {
323 323
             return $route;
324 324
         });
325
-        $router->addRoute('/searching-param-route/[i:id]/', function (string $route) {
325
+        $router->addRoute('/searching-param-route/[i:id]/', function(string $route) {
326 326
             return $route;
327 327
         });
328 328
 
Please login to merge, or discard this patch.