@@ -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) { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if ($staleIfErrorTo === null && $values->has('stale-if-error')) { |
| 71 | 71 | $this->staleIfErrorTo = (new \DateTime( |
| 72 | - '@'.($this->staleAt->getTimestamp() + (int) $values->get('stale-if-error')) |
|
| 72 | + '@'.($this->staleAt->getTimestamp() + (int)$values->get('stale-if-error')) |
|
| 73 | 73 | )); |
| 74 | 74 | } else { |
| 75 | 75 | $this->staleIfErrorTo = $staleIfErrorTo; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | if ($staleWhileRevalidateTo === null && $values->has('stale-while-revalidate')) { |
| 79 | 79 | $this->staleWhileRevalidateTo = new \DateTime( |
| 80 | - '@'.($this->staleAt->getTimestamp() + (int) $values->get('stale-while-revalidate')) |
|
| 80 | + '@'.($this->staleAt->getTimestamp() + (int)$values->get('stale-while-revalidate')) |
|
| 81 | 81 | ); |
| 82 | 82 | } else { |
| 83 | 83 | $this->staleWhileRevalidateTo = $staleWhileRevalidateTo; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $ttl = max($ttl, $this->staleAt->getTimestamp() - time()); |
| 246 | 246 | |
| 247 | 247 | // Don't return 0, it's reserved for infinite TTL |
| 248 | - return $ttl !== 0 ? (int) $ttl : -1; |
|
| 248 | + return $ttl !== 0 ? (int)$ttl : -1; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -290,12 +290,12 @@ discard block |
||
| 290 | 290 | if ($this->response !== null) { |
| 291 | 291 | $this->response = $this->response |
| 292 | 292 | ->withBody( |
| 293 | - \GuzzleHttp\Psr7\Utils::streamFor((string) $this->response->getBody()) |
|
| 293 | + \GuzzleHttp\Psr7\Utils::streamFor((string)$this->response->getBody()) |
|
| 294 | 294 | ); |
| 295 | 295 | } |
| 296 | 296 | $this->request = $this->request |
| 297 | 297 | ->withBody( |
| 298 | - \GuzzleHttp\Psr7\Utils::streamFor((string) $this->request->getBody()) |
|
| 298 | + \GuzzleHttp\Psr7\Utils::streamFor((string)$this->request->getBody()) |
|
| 299 | 299 | ); |
| 300 | 300 | } |
| 301 | 301 | |