Passed
Push — master ( 4cfdc5...37c7d0 )
by Alex
07:00
created
Mezon/Router/SimpleRoutesSet.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
                 $requestMethod . ' : '
168 168
             ];
169 169
             $hasRoutes = false;
170
-            if (! empty($this->staticRoutes[$requestMethod])) {
170
+            if (!empty($this->staticRoutes[$requestMethod])) {
171 171
                 $trace[] = implode(', ', array_keys($this->staticRoutes[$requestMethod]));
172 172
                 $trace[] = ', ';
173 173
                 $hasRoutes = true;
174 174
             }
175
-            if (! empty($this->paramRoutes[$requestMethod])) {
175
+            if (!empty($this->paramRoutes[$requestMethod])) {
176 176
                 $items = [];
177 177
                 foreach ($this->paramRoutes[$requestMethod] as $item) {
178 178
                     $items[] = $item['pattern'];
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 }
182 182
             }
183 183
 
184
-            if (! $hasRoutes) {
184
+            if (!$hasRoutes) {
185 185
                 $trace[] = '<none>';
186 186
             }
187 187
 
Please login to merge, or discard this patch.
Mezon/Router/RoutesSet.php 1 patch
Spacing   +8 added lines, -8 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
     private 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 = [];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     private function compileRegexpForBunches(): void
103 103
     {
104
-        if (! $this->regExpsWereCompiled) {
104
+        if (!$this->regExpsWereCompiled) {
105 105
             foreach (self::getListOfSupportedRequestMethods() as $requestMethod) {
106 106
                 foreach ($this->paramRoutes[$requestMethod] as &$bunch) {
107 107
                     $this->compileRegexpForBunch($bunch);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $this->paramRoutes[$requestMethod][] = [
138 138
                 'bunch' => []
139 139
             ];
140
-            $bunchCursor ++;
140
+            $bunchCursor++;
141 141
             $lastBunchSize = 0;
142 142
         }
143 143
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     protected function validateRequestMethod(string $requestMethod): void
164 164
     {
165 165
         if (isset($this->staticRoutes[$requestMethod]) === false) {
166
-            throw (new \Exception('Unsupported request method: "'.$requestMethod.'"'));
166
+            throw (new \Exception('Unsupported request method: "' . $requestMethod . '"'));
167 167
         }
168 168
     }
169 169
 
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
                 $requestMethod . ' : '
266 266
             ];
267 267
             $hasRoutes = false;
268
-            if (! empty($this->staticRoutes[$requestMethod])) {
268
+            if (!empty($this->staticRoutes[$requestMethod])) {
269 269
                 $trace[] = implode(', ', array_keys($this->staticRoutes[$requestMethod]));
270 270
                 $trace[] = ', ';
271 271
                 $hasRoutes = true;
272 272
             }
273
-            if (! empty($this->paramRoutes[$requestMethod])) {
273
+            if (!empty($this->paramRoutes[$requestMethod])) {
274 274
                 foreach ($this->paramRoutes[$requestMethod] as $bunch) {
275 275
                     $items = [];
276 276
                     foreach ($bunch['bunch'] as $item) {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 }
282 282
             }
283 283
 
284
-            if (! $hasRoutes) {
284
+            if (!$hasRoutes) {
285 285
                 $trace[] = '<none>';
286 286
             }
287 287
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/GetCallbackUnitTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         // setup
50 50
         RouterUnitTestUtils::setRequestMethod('GET');
51 51
         $router = new Router();
52
-        $router->addRoute($route, function () {
52
+        $router->addRoute($route, function() {
53 53
             return 'route result';
54 54
         });
55 55
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     {
72 72
         // setup
73 73
         $router = new Router();
74
-        $router->addRoute('existing-route', function () {
74
+        $router->addRoute('existing-route', function() {
75 75
             return 'existing route result';
76 76
         });
77 77
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/ExtractParametersUnitTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         // setup
31 31
         $router = new Router();
32
-        $router->addRoute('/catalog/[i:foo]/', function (): void {
32
+        $router->addRoute('/catalog/[i:foo]/', function(): void {
33 33
             // do nothing
34 34
         });
35 35
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $router = new Router();
49 49
         $router->addRoute(
50 50
             '/catalog/[a:cat_id]/',
51
-            function (string $route, array $parameters): string {
51
+            function(string $route, array $parameters): string {
52 52
                 return $parameters['cat_id'];
53 53
             });
54 54
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $router = new Router();
66 66
         $router->addRoute(
67 67
             '/catalog/[a:cat_id]/[i:item_id]',
68
-            function (string $route, array $parameters): string {
68
+            function(string $route, array $parameters): string {
69 69
                 return $parameters['cat_id'] . $parameters['item_id'];
70 70
             });
71 71
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     public function testValidRouteParameter(): void
81 81
     {
82 82
         $router = new Router();
83
-        $router->addRoute('/catalog/all/', function (string $route): string {
83
+        $router->addRoute('/catalog/all/', function(string $route): string {
84 84
             return $route;
85 85
         });
86
-        $router->addRoute('/catalog/[i:cat_id]', function (string $route): string {
86
+        $router->addRoute('/catalog/[i:cat_id]', function(string $route): string {
87 87
             return $route;
88 88
         });
89 89
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
     {
109 109
         // setup
110 110
         $router = new Router();
111
-        for ($i = 0; $i < 15; $i ++) {
112
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
111
+        for ($i = 0; $i < 15; $i++) {
112
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
113 113
                 return 'done!';
114 114
             });
115 115
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/StaticRoutesUnitTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function testArrayRoutes(): void
102 102
     {
103 103
         $router = new Router();
104
-        $router->addRoute('/part1/part2/', function (string $route): string {
104
+        $router->addRoute('/part1/part2/', function(string $route): string {
105 105
             return $route;
106 106
         }, 'GET');
107 107
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $this->setRequestUri('/catalog/item/');
122 122
 
123 123
         $router = new Router();
124
-        $router->addRoute('/catalog/item/', function (string $route): string {
124
+        $router->addRoute('/catalog/item/', function(string $route): string {
125 125
             return $route;
126 126
         }, 'GET');
127 127
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         $this->setRequestUri('/');
141 141
 
142 142
         $router = new Router();
143
-        $router->addRoute('/index/', function (string $route): string {
143
+        $router->addRoute('/index/', function(string $route): string {
144 144
             return $route;
145 145
         }, 'GET');
146 146
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $this->setRequestUri('/');
161 161
 
162 162
         $router = new Router();
163
-        $router->addRoute('/index/', function (string $route): string {
163
+        $router->addRoute('/index/', function(string $route): string {
164 164
             return $route;
165 165
         }, [
166 166
             'GET',
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     public function testClearMethod(string $method): void
283 283
     {
284 284
         $router = new Router();
285
-        $router->addRoute('/route-to-clear/', function () use ($method) {
285
+        $router->addRoute('/route-to-clear/', function() use ($method) {
286 286
             return $method;
287 287
         }, $method);
288 288
         $router->clear();
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         $_SERVER['REQUEST_METHOD'] = $method;
309 309
 
310 310
         $router = new Router();
311
-        $router->addRoute('/catalog/', function (string $route): string {
311
+        $router->addRoute('/catalog/', function(string $route): string {
312 312
             return $route;
313 313
         }, $method);
314 314
 
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
     {
325 325
         // setup
326 326
         $router = new Router();
327
-        $router->addRoute('/searching-static-route/', function (string $route) {
327
+        $router->addRoute('/searching-static-route/', function(string $route) {
328 328
             return $route;
329 329
         });
330
-        $router->addRoute('/searching-param-route/[i:id]/', function (string $route) {
330
+        $router->addRoute('/searching-param-route/[i:id]/', function(string $route) {
331 331
             return $route;
332 332
         });
333 333
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/DynamicRoutesInvalidCasesUnitTest.php 1 patch
Spacing   +9 added lines, -9 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 Router();
31
-        $router->addRoute('/catalog/[i:foo]/', function () {
31
+        $router->addRoute('/catalog/[i:foo]/', function() {
32 32
             // do nothing
33 33
         });
34 34
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         // setup
49 49
         $_SERVER['REQUEST_METHOD'] = 'HEAD';
50 50
         $router = new Router();
51
-        $router->addRoute('/catalog/[i:foo]/', function () {
51
+        $router->addRoute('/catalog/[i:foo]/', function() {
52 52
             // do nothing
53 53
         });
54 54
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $router = new Router();
69 69
         $router->addRoute('/catalog/[il:cat_id]/', [
70 70
             $this,
71
-            function () {return 1;}
71
+            function() {return 1; }
72 72
         ]);
73 73
 
74 74
         // assertion
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $router = new Router();
91 91
         $router->addRoute('/catalog/[i:cat_id]', [
92 92
             $this,
93
-            function () {return 1;}
93
+            function() {return 1; }
94 94
         ]);
95 95
 
96 96
         try {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $router = new Router();
116 116
         $router->addRoute('/catalog/[i:cat_id]', [
117 117
             $this,
118
-            function () {return 1;}
118
+            function() {return 1; }
119 119
         ]);
120 120
 
121 121
         try {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         $router = new Router();
141 141
         $router->addRoute('/catalog/[i:item_id]', [
142 142
             $this,
143
-            function () {return 1;}
143
+            function() {return 1; }
144 144
         ]);
145 145
 
146 146
         try {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         // setup
184 184
         $router = new Router();
185
-        $router->addRoute($route, function () {
185
+        $router->addRoute($route, function() {
186 186
             // do nothing
187 187
         });
188 188
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $router = new Router();
202 202
         $router->addRoute('/catalog/[unexisting-type:i]/item/', [
203 203
             $this,
204
-            function () {return 1;}
204
+            function() {return 1; }
205 205
         ]);
206 206
 
207 207
         try {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $router = new Router();
221 221
         $router->addRoute('/catalog/[i:cat_id]/item/[unexisting-type-trace:item_id]/', [
222 222
             $this,
223
-            function () {return 1;}
223
+            function() {return 1; }
224 224
         ]);
225 225
 
226 226
         try {
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/BigSetOfRoutesUnitTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@
 block discarded – undo
40 40
         // setup
41 41
         RouterUnitTestUtils::setRequestMethod('GET');
42 42
         $router = new Router();
43
-        for ($i = 1; $i <= $amount; $i ++) {
44
-            $router->addRoute('/param/[i:id]/' . $i, function () use ($i): int {
43
+        for ($i = 1; $i <= $amount; $i++) {
44
+            $router->addRoute('/param/[i:id]/' . $i, function() use ($i): int {
45 45
                 return $i;
46 46
             });
47 47
         }
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/DynamicRoutesUnitTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
         $router = new Router();
163 163
         $router->addType('date', DateRouterType::class);
164 164
         if (is_string($pattern)) {
165
-            $router->addRoute($pattern, function () {
165
+            $router->addRoute($pattern, function() {
166 166
                 // do nothing
167 167
             }, $method);
168 168
         } else {
169 169
             foreach ($pattern as $r) {
170
-                $router->addRoute($r, function () {
170
+                $router->addRoute($r, function() {
171 171
                     // do nothing
172 172
                 }, $method);
173 173
             }
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
     {
186 186
         // setup
187 187
         $router = new Router();
188
-        for ($i = 0; $i < 15; $i ++) {
189
-            $router->addRoute('/multiple/' . $i . '/[i:id]', function () {
188
+        for ($i = 0; $i < 15; $i++) {
189
+            $router->addRoute('/multiple/' . $i . '/[i:id]', function() {
190 190
                 return 'done!';
191 191
             });
192 192
         }
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
     {
207 207
         // setup
208 208
         $router = new Router();
209
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function () {
209
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]', function() {
210 210
             return 'get-custom-field';
211 211
         });
212
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function () {
212
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function() {
213 213
             return 'add-custom-field';
214 214
         });
215
-        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function () {
215
+        $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function() {
216 216
             return 'delete-custom-field';
217 217
         });
218
-        $router->addRoute('/restore-password/[s:token]', function () {
218
+        $router->addRoute('/restore-password/[s:token]', function() {
219 219
             return 'restore-password';
220 220
         });
221
-        $router->addRoute('/reset-password/[s:token]', function () {
221
+        $router->addRoute('/reset-password/[s:token]', function() {
222 222
             return 'reset-password';
223 223
         });
224
-        $router->addRoute('/user/[s:login]/delete', function () {
224
+        $router->addRoute('/user/[s:login]/delete', function() {
225 225
             return 'user-delete';
226 226
         });
227 227
 
Please login to merge, or discard this patch.
Mezon/Router/Tests/Standart/ReverseRouteUnitTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     {
61 61
         // setup
62 62
         $router = new Router();
63
-        $router->addRoute($route, function () {
63
+        $router->addRoute($route, function() {
64 64
             return 'named route result';
65 65
         }, 'GET', 'named-route');
66 66
 
Please login to merge, or discard this patch.