| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.1755 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 15 | public function __construct($value) |
|
| 17 | { |
||
| 18 | 15 | if (!is_resource($value)) { |
|
| 19 | throw new \InvalidArgumentException('Invalid key.'); |
||
| 20 | } |
||
| 21 | |||
| 22 | 15 | $keyDetails = openssl_pkey_get_details($value); |
|
| 23 | |||
| 24 | 15 | if (!is_array($keyDetails) || !isset($keyDetails['type'])) { |
|
| 25 | throw new \InvalidArgumentException('Invalid key.'); |
||
| 26 | } |
||
| 27 | |||
| 28 | 15 | $this->value = $value; |
|
| 29 | 15 | $this->type = $keyDetails['type']; |
|
| 30 | 15 | } |
|
| 31 | |||
| 45 |