@@ 10-35 (lines=26) @@ | ||
7 | use Psr\Cache\CacheItemInterface; |
|
8 | use Psr\Cache\CacheItemPoolInterface; |
|
9 | ||
10 | class PoolDecorator extends BasePoolDecorator |
|
11 | { |
|
12 | /** @var PasswordInterface */ |
|
13 | private $password; |
|
14 | /** @var string */ |
|
15 | private $cipher; |
|
16 | ||
17 | public function __construct( |
|
18 | CacheItemPoolInterface $decorated, |
|
19 | $password, |
|
20 | $cipher = Iron\Iron::DEFAULT_ENCRYPTION_METHOD |
|
21 | ) { |
|
22 | parent::__construct($decorated); |
|
23 | $this->password = Iron\normalize_password($password); |
|
24 | $this->cipher = $cipher; |
|
25 | } |
|
26 | ||
27 | protected function decorate(CacheItemInterface $inner) |
|
28 | { |
|
29 | return new ItemDecorator( |
|
30 | $inner, |
|
31 | $this->password, |
|
32 | $this->cipher |
|
33 | ); |
|
34 | } |
|
35 | } |
|
36 |
@@ 8-38 (lines=31) @@ | ||
5 | use Psr\Cache\CacheItemInterface; |
|
6 | use Psr\Cache\CacheItemPoolInterface; |
|
7 | ||
8 | class PoolDecorator extends BasePoolDecorator |
|
9 | { |
|
10 | /** @var string */ |
|
11 | private $password; |
|
12 | /** @var string */ |
|
13 | private $cipher; |
|
14 | ||
15 | /** |
|
16 | * @param CacheItemPoolInterface $decorated |
|
17 | * @param string $password |
|
18 | * @param string $cipher |
|
19 | */ |
|
20 | public function __construct( |
|
21 | CacheItemPoolInterface $decorated, |
|
22 | $password, |
|
23 | $cipher = 'aes-256-cbc' |
|
24 | ) { |
|
25 | parent::__construct($decorated); |
|
26 | $this->password = $password; |
|
27 | $this->cipher = $cipher; |
|
28 | } |
|
29 | ||
30 | protected function decorate(CacheItemInterface $item) |
|
31 | { |
|
32 | return new ItemDecorator( |
|
33 | $item, |
|
34 | $this->password, |
|
35 | $this->cipher |
|
36 | ); |
|
37 | } |
|
38 | } |
|
39 |