Skip to content

Commit b892c00

Browse files
committed
Feedback fixes
1 parent 39facb8 commit b892c00

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/CachePlugin.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static function clientCache(CacheItemPoolInterface $pool, StreamFactory $
9191
if (isset($config['respect_response_cache_directives'])) {
9292
$config['respect_response_cache_directives'][] = 'no-cache';
9393
$config['respect_response_cache_directives'][] = 'max-age';
94-
array_unique($config['respect_response_cache_directives']);
94+
$config['respect_response_cache_directives'] = array_unique($config['respect_response_cache_directives']);
9595
} else {
9696
$config['respect_response_cache_directives'] = ['no-cache', 'max-age'];
9797
}
@@ -240,9 +240,9 @@ protected function isCacheable(ResponseInterface $response)
240240
return false;
241241
}
242242

243-
$cacheableDirectives = $this->extractDirectives($this->config['respect_response_cache_directives'], $this->noCacheFlags);
244-
foreach ($cacheableDirectives as $cacheableDirective) {
245-
if ($this->getCacheControlDirective($response, $cacheableDirective)) {
243+
$nocacheDirectives = array_intersect($this->config['respect_response_cache_directives'], $this->noCacheFlags);
244+
foreach ($nocacheDirectives as $nocacheDirective) {
245+
if ($this->getCacheControlDirective($response, $nocacheDirective)) {
246246
return false;
247247
}
248248
}
@@ -431,9 +431,4 @@ private function getETag(CacheItemInterface $cacheItem)
431431
}
432432
}
433433
}
434-
435-
private function extractDirectives($directives, $extractDirectivesList)
436-
{
437-
return array_intersect($directives, $extractDirectivesList);
438-
}
439434
}

0 commit comments

Comments
 (0)