Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
58 | 6 | public static function fromPEM(PEM $pem) |
|
59 | { |
||
60 | 6 | switch ($pem->type()) { |
|
61 | 6 | case PEM::TYPE_RSA_PUBLIC_KEY: |
|
62 | 1 | return RSA\RSAPublicKey::fromDER($pem->data()); |
|
63 | 5 | case PEM::TYPE_PUBLIC_KEY: |
|
64 | 4 | return PublicKeyInfo::fromPEM($pem)->publicKey(); |
|
65 | } |
||
66 | 1 | throw new \UnexpectedValueException( |
|
67 | 1 | 'PEM type ' . $pem->type() . ' is not a valid public key.'); |
|
68 | } |
||
70 |