| Total Complexity | 5 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Crypt |
||
| 6 | { |
||
| 7 | /** @var string $cipher */ |
||
| 8 | private $cipher = 'aes-128-gcm'; |
||
| 9 | |||
| 10 | /** @var int $options */ |
||
| 11 | private $options = 0; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param int $length |
||
| 15 | * @return string |
||
| 16 | */ |
||
| 17 | 1 | private function generateRandomBytes(int $length): string |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $plaintext |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | 1 | public function encrypt(string $plaintext): array |
|
| 44 | ]; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $json |
||
| 49 | * @param string $key |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | 1 | public function decrypt(string $json, string$key): string |
|
| 60 |