1 | <?php |
||
6 | abstract class ItemDecorator implements CacheItemInterface |
||
7 | { |
||
8 | /** @var string */ |
||
9 | private $cipher; |
||
10 | /** @var mixed */ |
||
11 | private $decrypted; |
||
12 | /** @var CacheItemInterface */ |
||
13 | private $decorated; |
||
14 | |||
15 | 333 | public function __construct($cipher, CacheItemInterface $decorated) |
|
20 | |||
21 | 228 | public function getKey() |
|
25 | |||
26 | 174 | /** |
|
27 | * @return CacheItemInterface |
||
28 | 174 | */ |
|
29 | 132 | public function getDecorated() |
|
33 | |||
34 | public function set($value) |
||
41 | |||
42 | 222 | public function get() |
|
50 | 144 | ||
51 | 144 | public function isHit() |
|
56 | 6 | ||
57 | public function expiresAt($expiresAt) |
||
63 | 12 | ||
64 | public function expiresAfter($expiresAfter) |
||
70 | |||
71 | protected function generateIv() |
||
75 | |||
76 | 222 | protected function encryptString($string, $key, $iv) |
|
80 | |||
81 | 222 | protected function decryptString($string, $method, $key, $iv) |
|
85 | |||
86 | 222 | protected function getCipherMethod() |
|
90 | |||
91 | 132 | /** |
|
92 | * @param $data |
||
93 | 132 | * |
|
94 | * @return EncryptedValue |
||
95 | */ |
||
96 | abstract protected function encrypt($data); |
||
97 | |||
98 | /** |
||
99 | * @param EncryptedValue $data |
||
100 | * |
||
101 | * @return mixed |
||
102 | */ |
||
103 | abstract protected function decrypt($data); |
||
104 | |||
105 | /** |
||
106 | * @return bool |
||
107 | */ |
||
108 | abstract protected function isDecryptable(); |
||
109 | } |
||
110 |