From 480f56b7f636a79368e9040813536f5903143915 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Sun, 15 Apr 2018 08:01:06 +0200 Subject: [PATCH] CS --- .../HttpCache/ResponseCacheStrategy.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php index 151f3d4d84a64..6737bfd839af5 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php @@ -30,15 +30,13 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface { /** * Cache-Control headers that are sent to the final response if they appear in ANY of the responses. - * @var array */ - private static $overrideDirectives = ['no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate']; + private static $overrideDirectives = array('no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'); /** * Cache-Control headers that are sent to the final response if the appear in ALL of the responses. - * @var array */ - private static $inheritDirectives = ['public', 'private', 'immutable']; + private static $inheritDirectives = array('public', 'private', 'immutable'); private $embeddedResponses = 0; private $isNotCacheableResponseEmbedded = false; @@ -90,8 +88,8 @@ public function add(Response $response) $this->storeRelativeAgeDirective('s-maxage', $response->headers->getCacheControlDirective('s-maxage'), $age); $expires = $response->getExpires(); - $expires = null === $expires ? null : $expires->format('U') - $response->getDate()->format('U'); - $this->storeRelativeAgeDirective('expires', $expires < 0 ? null : $expires, 0); + $expires = null !== $expires ? $expires->format('U') - $response->getDate()->format('U') : null; + $this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0); } /** @@ -146,8 +144,6 @@ public function update(Response $response) * * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4 * - * @param Response $response - * * @return bool */ private function isUncacheable(Response $response) @@ -165,7 +161,7 @@ private function isUncacheable(Response $response) // A response received with any other status code (e.g. status codes 302 and 307) // MUST NOT be returned in a reply to a subsequent request unless there are // cache-control directives or another header(s) that explicitly allow it. - $cacheControl = ['max-age', 's-maxage', 'must-revalidate', 'proxy-revalidate', 'public', 'private', 'must-revalidate']; + $cacheControl = array('max-age', 's-maxage', 'must-revalidate', 'proxy-revalidate', 'public', 'private', 'must-revalidate'); foreach ($cacheControl as $key) { if ($response->headers->hasCacheControlDirective($key)) { return false; @@ -194,7 +190,7 @@ private function storeRelativeAgeDirective($cacheKey, $value, $age) if (false !== $this->ageDirectives[$cacheKey]) { $value = $value - $age; - $this->ageDirectives[$cacheKey] = null === $this->ageDirectives[$cacheKey] ? $value : min($this->ageDirectives[$cacheKey], $value); + $this->ageDirectives[$cacheKey] = null !== $this->ageDirectives[$cacheKey] ? min($this->ageDirectives[$cacheKey], $value) : $value; } } }