@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | |
77 | 77 | if ($staleIfErrorTo === null && $values->has('stale-if-error')) { |
78 | 78 | $this->staleIfErrorTo = (new \DateTime( |
79 | - '@'.($this->staleAt->getTimestamp() + (int) $values->get('stale-if-error')) |
|
79 | + '@' . ($this->staleAt->getTimestamp() + (int)$values->get('stale-if-error')) |
|
80 | 80 | )); |
81 | 81 | } else { |
82 | 82 | $this->staleIfErrorTo = $staleIfErrorTo; |
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($staleWhileRevalidateTo === null && $values->has('stale-while-revalidate')) { |
86 | - $this->staleWhileRevalidateTo = new \DateTime('+'.$values->get('stale-while-revalidate').'seconds'); |
|
86 | + $this->staleWhileRevalidateTo = new \DateTime('+' . $values->get('stale-while-revalidate') . 'seconds'); |
|
87 | 87 | } else { |
88 | 88 | $this->staleWhileRevalidateTo = $staleWhileRevalidateTo; |
89 | 89 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // Don't return 0, it's reserved for infinite TTL |
216 | - return $ttl !== 0 ? (int) $ttl : -1; |
|
216 | + return $ttl !== 0 ? (int)$ttl : -1; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | { |
229 | 229 | // Stream/Resource can't be serialized... So we copy the content |
230 | 230 | if ($this->response !== null) { |
231 | - $this->responseBody = (string) $this->response->getBody(); |
|
231 | + $this->responseBody = (string)$this->response->getBody(); |
|
232 | 232 | $this->response->getBody()->rewind(); |
233 | 233 | } |
234 | 234 |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function __invoke(callable $handler) |
111 | 111 | { |
112 | - return function (RequestInterface $request, array $options) use (&$handler) { |
|
112 | + return function(RequestInterface $request, array $options) use (&$handler) { |
|
113 | 113 | if (!isset($this->httpMethods[strtoupper($request->getMethod())])) { |
114 | 114 | // No caching for this method allowed |
115 | 115 | return $handler($request, $options)->then( |
116 | - function (ResponseInterface $response) { |
|
116 | + function(ResponseInterface $response) { |
|
117 | 117 | return $response->withHeader(self::HEADER_CACHE_INFO, self::HEADER_CACHE_MISS); |
118 | 118 | } |
119 | 119 | ); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $promise = $handler($request, $options); |
178 | 178 | |
179 | 179 | return $promise->then( |
180 | - function (ResponseInterface $response) use ($request, $cacheEntry) { |
|
180 | + function(ResponseInterface $response) use ($request, $cacheEntry) { |
|
181 | 181 | // Check if error and looking for a staled content |
182 | 182 | if ($response->getStatusCode() >= 500) { |
183 | 183 | $responseStale = static::getStaleResponse($cacheEntry); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | return $response; |
204 | 204 | }, |
205 | - function (\Exception $ex) use ($cacheEntry) { |
|
205 | + function(\Exception $ex) use ($cacheEntry) { |
|
206 | 206 | if ($ex instanceof TransferException) { |
207 | 207 | $response = static::getStaleResponse($cacheEntry); |
208 | 208 | if ($response instanceof ResponseInterface) { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function addReValidationRequest( |
227 | 227 | RequestInterface $request, |
228 | - CacheStrategyInterface &$cacheStorage, |
|
228 | + CacheStrategyInterface & $cacheStorage, |
|
229 | 229 | CacheEntry $cacheEntry |
230 | 230 | ) { |
231 | 231 | // Add the promise for revalidate |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $request = $request->withHeader(self::HEADER_RE_VALIDATION, '1'); |
235 | 235 | $this->waitingRevalidate[] = $this->client |
236 | 236 | ->sendAsync($request) |
237 | - ->then(function (ResponseInterface $response) use ($request, &$cacheStorage, $cacheEntry) { |
|
237 | + ->then(function(ResponseInterface $response) use ($request, &$cacheStorage, $cacheEntry) { |
|
238 | 238 | if ($response->getStatusCode() == 304) { |
239 | 239 | // Not modified => cache entry is re-validate |
240 | 240 | /** @var ResponseInterface $response */ |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return new CacheEntry( |
94 | 94 | $request, |
95 | 95 | $response, |
96 | - new \DateTime('+'.(int) $cacheControl->get($key).'seconds') |
|
96 | + new \DateTime('+' . (int)$cacheControl->get($key) . 'seconds') |
|
97 | 97 | ); |
98 | 98 | } |
99 | 99 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | protected function getCacheKey(RequestInterface $request) |
121 | 121 | { |
122 | 122 | return sha1( |
123 | - $request->getMethod().$request->getUri() |
|
123 | + $request->getMethod() . $request->getUri() |
|
124 | 124 | ); |
125 | 125 | } |
126 | 126 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | protected function getCacheKey(RequestInterface $request) |
34 | 34 | { |
35 | 35 | return sha1( |
36 | - 'greedy'.$request->getMethod().$request->getUri() |
|
36 | + 'greedy' . $request->getMethod() . $request->getUri() |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 |