| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 20 | public function __construct(string $filePath, string $passphrase = '', ?string $id = null) |
||
| 21 | { |
||
| 22 | try { |
||
| 23 | $this->resource = openssl_pkey_get_private(file_get_contents(realpath($filePath)), $passphrase); |
||
| 24 | } catch (Throwable $e) { |
||
| 25 | throw new InvalidKeyException('Failed to read the key.', 0, $e); |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($this->resource === false) { |
||
| 29 | throw new InvalidKeyException(openssl_error_string()); |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->id = $id; |
||
| 33 | } |
||
| 48 |