Conditions | 3 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 9 | public function encrypt(string $payload): string |
|
23 | { |
||
24 | try { |
||
25 | 9 | $encrypted = (string) ($this->crypto->encrypt($payload) ?: throw CryptographyException::encryptFailure()); |
|
26 | 2 | } catch (\Throwable $e) { |
|
27 | 2 | throw CryptographyException::fromThrowable($e); |
|
28 | } |
||
29 | |||
30 | 7 | return sprintf('<ENC>%s</ENC>', base64_encode($encrypted)); |
|
31 | } |
||
46 |