@@ -93,7 +93,7 @@ |
||
| 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 | } |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function __invoke(callable $handler) |
| 113 | 113 | { |
| 114 | - return function (RequestInterface $request, array $options) use (&$handler) { |
|
| 114 | + return function(RequestInterface $request, array $options) use (&$handler) { |
|
| 115 | 115 | if (!isset($this->httpMethods[strtoupper($request->getMethod())])) { |
| 116 | 116 | // No caching for this method allowed |
| 117 | 117 | |
| 118 | 118 | return $handler($request, $options)->then( |
| 119 | - function (ResponseInterface $response) use ($request) { |
|
| 119 | + function(ResponseInterface $response) use ($request) { |
|
| 120 | 120 | // Invalidate cache after a call of non-safe method on the same URI |
| 121 | 121 | $response = $this->invalidateCache($request, $response); |
| 122 | 122 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $promise = $handler($request, $options); |
| 189 | 189 | |
| 190 | 190 | return $promise->then( |
| 191 | - function (ResponseInterface $response) use ($request, $cacheEntry) { |
|
| 191 | + function(ResponseInterface $response) use ($request, $cacheEntry) { |
|
| 192 | 192 | // Check if error and looking for a staled content |
| 193 | 193 | if ($response->getStatusCode() >= 500) { |
| 194 | 194 | $responseStale = static::getStaleResponse($cacheEntry); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | return static::addToCache($this->cacheStorage, $request, $response, $update); |
| 227 | 227 | }, |
| 228 | - function ($reason) use ($cacheEntry) { |
|
| 228 | + function($reason) use ($cacheEntry) { |
|
| 229 | 229 | if ($reason instanceof TransferException) { |
| 230 | 230 | $response = static::getStaleResponse($cacheEntry); |
| 231 | 231 | if ($response instanceof ResponseInterface) { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $request = $request->withHeader(self::HEADER_RE_VALIDATION, '1'); |
| 287 | 287 | $this->waitingRevalidate[] = $this->client |
| 288 | 288 | ->sendAsync($request) |
| 289 | - ->then(function (ResponseInterface $response) use ($request, &$cacheStorage, $cacheEntry) { |
|
| 289 | + ->then(function(ResponseInterface $response) use ($request, &$cacheStorage, $cacheEntry) { |
|
| 290 | 290 | $update = false; |
| 291 | 291 | |
| 292 | 292 | if ($response->getStatusCode() == 304) { |
@@ -76,7 +76,7 @@ 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; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | if ($staleWhileRevalidateTo === null && $values->has('stale-while-revalidate')) { |
| 86 | 86 | $this->staleWhileRevalidateTo = new \DateTime( |
| 87 | - '@'.($this->staleAt->getTimestamp() + (int) $values->get('stale-while-revalidate')) |
|
| 87 | + '@'.($this->staleAt->getTimestamp() + (int)$values->get('stale-while-revalidate')) |
|
| 88 | 88 | ); |
| 89 | 89 | } else { |
| 90 | 90 | $this->staleWhileRevalidateTo = $staleWhileRevalidateTo; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $ttl = max($ttl, $this->staleAt->getTimestamp() - time()); |
| 247 | 247 | |
| 248 | 248 | // Don't return 0, it's reserved for infinite TTL |
| 249 | - return $ttl !== 0 ? (int) $ttl : -1; |
|
| 249 | + return $ttl !== 0 ? (int)$ttl : -1; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | // Stream/Resource can't be serialized... So we copy the content |
| 263 | 263 | if ($this->response !== null) { |
| 264 | - $this->responseBody = (string) $this->response->getBody(); |
|
| 264 | + $this->responseBody = (string)$this->response->getBody(); |
|
| 265 | 265 | $this->response->getBody()->rewind(); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | { |
| 55 | 55 | try { |
| 56 | 56 | return $this->filesystem->delete($key); |
| 57 | - } catch (FileNotFoundException $ex){ |
|
| 57 | + } catch (FileNotFoundException $ex) { |
|
| 58 | 58 | return true; |
| 59 | 59 | } |
| 60 | 60 | } |