Passed
Push — master ( a859a4...ed53b9 )
by Cees-Jan
01:35
created
src/WithRandomHeadersMiddleware.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace WyriHaximus\React\Http\Middleware;
4 4
 
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 final class WithRandomHeadersMiddleware
10 10
 {
11
-    private $headers = [];
11
+    private $headers = [ ];
12 12
 
13 13
     private $minimum = 2;
14 14
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function __invoke(ServerRequestInterface $request, callable $next)
39 39
     {
40
-        return resolve($next($request))->then(function (ResponseInterface $response) {
40
+        return resolve($next($request))->then(function(ResponseInterface $response) {
41 41
             $count = random_int($this->minimum, $this->maximum);
42 42
             $headers = $this->headers;
43 43
             for ($i = 0; $i < $count; $i++) {
44 44
                 $randomizer = array_keys($headers);
45
-                $header = $randomizer[random_int(0, count($headers) - 1)];
46
-                $response = $response->withHeader($header, $headers[$header]);
47
-                unset($headers[$header]);
45
+                $header = $randomizer[ random_int(0, count($headers) - 1) ];
46
+                $response = $response->withHeader($header, $headers[ $header ]);
47
+                unset($headers[ $header ]);
48 48
             }
49 49
 
50 50
             return resolve($response);
Please login to merge, or discard this patch.