Skip to content

Commit 480f56b

Browse files
committed
CS
1 parent fd6f22d commit 480f56b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
3030
{
3131
/**
3232
* Cache-Control headers that are sent to the final response if they appear in ANY of the responses.
33-
* @var array
3433
*/
35-
private static $overrideDirectives = ['no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'];
34+
private static $overrideDirectives = array('no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate');
3635

3736
/**
3837
* Cache-Control headers that are sent to the final response if the appear in ALL of the responses.
39-
* @var array
4038
*/
41-
private static $inheritDirectives = ['public', 'private', 'immutable'];
39+
private static $inheritDirectives = array('public', 'private', 'immutable');
4240

4341
private $embeddedResponses = 0;
4442
private $isNotCacheableResponseEmbedded = false;
@@ -90,8 +88,8 @@ public function add(Response $response)
9088
$this->storeRelativeAgeDirective('s-maxage', $response->headers->getCacheControlDirective('s-maxage'), $age);
9189

9290
$expires = $response->getExpires();
93-
$expires = null === $expires ? null : $expires->format('U') - $response->getDate()->format('U');
94-
$this->storeRelativeAgeDirective('expires', $expires < 0 ? null : $expires, 0);
91+
$expires = null !== $expires ? $expires->format('U') - $response->getDate()->format('U') : null;
92+
$this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0);
9593
}
9694

9795
/**
@@ -146,8 +144,6 @@ public function update(Response $response)
146144
*
147145
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4
148146
*
149-
* @param Response $response
150-
*
151147
* @return bool
152148
*/
153149
private function isUncacheable(Response $response)
@@ -165,7 +161,7 @@ private function isUncacheable(Response $response)
165161
// A response received with any other status code (e.g. status codes 302 and 307)
166162
// MUST NOT be returned in a reply to a subsequent request unless there are
167163
// cache-control directives or another header(s) that explicitly allow it.
168-
$cacheControl = ['max-age', 's-maxage', 'must-revalidate', 'proxy-revalidate', 'public', 'private', 'must-revalidate'];
164+
$cacheControl = array('max-age', 's-maxage', 'must-revalidate', 'proxy-revalidate', 'public', 'private', 'must-revalidate');
169165
foreach ($cacheControl as $key) {
170166
if ($response->headers->hasCacheControlDirective($key)) {
171167
return false;
@@ -194,7 +190,7 @@ private function storeRelativeAgeDirective($cacheKey, $value, $age)
194190

195191
if (false !== $this->ageDirectives[$cacheKey]) {
196192
$value = $value - $age;
197-
$this->ageDirectives[$cacheKey] = null === $this->ageDirectives[$cacheKey] ? $value : min($this->ageDirectives[$cacheKey], $value);
193+
$this->ageDirectives[$cacheKey] = null !== $this->ageDirectives[$cacheKey] ? min($this->ageDirectives[$cacheKey], $value) : $value;
198194
}
199195
}
200196
}

0 commit comments

Comments
 (0)