Skip to content

Commit b033596

Browse files
committed
Use array_unique instead of multiple ifs
1 parent 9a91887 commit b033596

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/CachePlugin.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,9 @@ public static function clientCache(CacheItemPoolInterface $pool, StreamFactory $
8686
{
8787
// Allow caching of private requests
8888
if (isset($config['respect_response_cache_directives'])) {
89-
if (!in_array('no-cache', $config['respect_response_cache_directives'], true)) {
90-
$config['respect_response_cache_directives'][] = ['no-cache'];
91-
}
92-
if (!in_array('max-age', $config['respect_response_cache_directives'], true)) {
93-
$config['respect_response_cache_directives'][] = ['max-age'];
94-
}
89+
$config['respect_response_cache_directives'][] = 'no-cache';
90+
$config['respect_response_cache_directives'][] = 'max-age';
91+
array_unique($config['respect_response_cache_directives']);
9592
} else {
9693
$config['respect_response_cache_directives'] = ['no-cache', 'max-age'];
9794
}

0 commit comments

Comments
 (0)