| Conditions | 7 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function __construct($keyMaterial, $algorithm) |
||
| 21 | { |
||
| 22 | if ( |
||
| 23 | !is_string($keyMaterial) |
||
| 24 | && !is_resource($keyMaterial) |
||
| 25 | && !$keyMaterial instanceof OpenSSLAsymmetricKey |
||
|
|
|||
| 26 | ) { |
||
| 27 | throw new InvalidArgumentException('Type error: $keyMaterial must be a string, resource, or OpenSSLAsymmetricKey'); |
||
| 28 | } |
||
| 29 | |||
| 30 | if (empty($keyMaterial)) { |
||
| 31 | throw new InvalidArgumentException('Type error: $keyMaterial must not be empty'); |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!is_string($algorithm)|| empty($keyMaterial)) { |
||
| 35 | throw new InvalidArgumentException('Type error: $algorithm must be a string'); |
||
| 36 | } |
||
| 37 | |||
| 38 | $this->keyMaterial = $keyMaterial; |
||
| 39 | $this->algorithm = $algorithm; |
||
| 40 | } |
||
| 60 |