@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace WyriHaximus\React\Http\Middleware; |
4 | 4 | |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | { |
37 | 37 | $this->staticUrls = array_filter( |
38 | 38 | $urls, |
39 | - function ($url) { |
|
39 | + function($url) { |
|
40 | 40 | return !(strlen($url) >= 3 && substr($url, -3) === '***'); |
41 | 41 | } |
42 | 42 | ); |
43 | 43 | $this->prefixUrls = array_map( |
44 | - function ($url) { |
|
44 | + function($url) { |
|
45 | 45 | return substr($url, 0, -3); |
46 | 46 | }, |
47 | 47 | array_filter( |
48 | 48 | $urls, |
49 | - function ($url) { |
|
49 | + function($url) { |
|
50 | 50 | return strlen($url) >= 3 && substr($url, -3) === '***'; |
51 | 51 | } |
52 | 52 | ) |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | |
70 | 70 | $key = $uri; |
71 | 71 | |
72 | - return $this->cache->get($key)->then(function ($json) { |
|
72 | + return $this->cache->get($key)->then(function($json) { |
|
73 | 73 | $cachedResponse = json_decode($json); |
74 | 74 | |
75 | - return new Response($cachedResponse->code, (array)$cachedResponse->headers, stream_for($cachedResponse->body)); |
|
76 | - }, function () use ($next, $request, $key) { |
|
77 | - return resolve($next($request))->then(function (ResponseInterface $response) use ($key) { |
|
75 | + return new Response($cachedResponse->code, (array) $cachedResponse->headers, stream_for($cachedResponse->body)); |
|
76 | + }, function() use ($next, $request, $key) { |
|
77 | + return resolve($next($request))->then(function(ResponseInterface $response) use ($key) { |
|
78 | 78 | if ($response->getBody() instanceof HttpBodyStream) { |
79 | 79 | return $response; |
80 | 80 | } |
81 | 81 | |
82 | - $body = (string)$response->getBody(); |
|
82 | + $body = (string) $response->getBody(); |
|
83 | 83 | $headers = []; |
84 | 84 | foreach ($this->headers as $header) { |
85 | 85 | if (!$response->hasHeader($header)) { |