Skip to content

Commit c340f6b

Browse files
committed
Renamed to SharedCacheKeyGenerator
1 parent de5611f commit c340f6b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spec/Cache/Generator/HeaderHashGeneratorSpec.php renamed to spec/Cache/Generator/SharedCacheKeyGeneratorSpec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use PhpSpec\ObjectBehavior;
66
use Psr\Http\Message\RequestInterface;
77

8-
class HeaderHashGeneratorSpec extends ObjectBehavior
8+
class SharedCacheKeyGeneratorSpec extends ObjectBehavior
99
{
1010
public function let()
1111
{
@@ -14,7 +14,7 @@ public function let()
1414

1515
public function it_is_initializable()
1616
{
17-
$this->shouldHaveType('Http\Client\Common\Plugin\Cache\Generator\HeaderHashGenerator');
17+
$this->shouldHaveType('Http\Client\Common\Plugin\Cache\Generator\SharedCacheKeyGenerator');
1818
}
1919

2020
public function it_is_a_key_generator()

src/Cache/Generator/HeaderHashGenerator.php renamed to src/Cache/Generator/SharedCacheKeyGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use Psr\Http\Message\RequestInterface;
66

77
/**
8-
* Generate a cache key by specify what headers you want to vary on.
8+
* Generate a cache key by vary on Cookie and Authorization header.
99
*
1010
* @author Tobias Nyholm <[email protected]>
1111
*/
12-
class HeaderHashGenerator implements CacheKeyGenerator
12+
class SharedCacheKeyGenerator implements CacheKeyGenerator
1313
{
1414
/**
1515
* The header names we should take into account when creating the cache key.
@@ -19,9 +19,9 @@ class HeaderHashGenerator implements CacheKeyGenerator
1919
private $headerNames;
2020

2121
/**
22-
* @param $headerNames
22+
* @param array $headerNames defaults to Authorization and Cookie
2323
*/
24-
public function __construct(array $headerNames)
24+
public function __construct(array $headerNames = ['Authorization', 'Cookie'])
2525
{
2626
$this->headerNames = $headerNames;
2727
}

0 commit comments

Comments
 (0)