| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 1 | public static function toPem($pfx, $password): string |
|
| 18 | { |
||
| 19 | 1 | $p12cert = array(); |
|
| 20 | 1 | $p12buf = self::read($pfx); |
|
| 21 | 1 | $p12cert = self::pkcs12Read($p12buf, $p12cert, $password); |
|
| 22 | |||
| 23 | 1 | if (empty($p12cert['cert']) || empty($p12cert['pkey'])) { |
|
| 24 | throw new \RuntimeException('Cert file not include info.'); |
||
| 25 | } |
||
| 26 | |||
| 27 | 1 | $pem = $p12cert['cert'] . "\n" . $p12cert['pkey'] . "\n"; |
|
| 28 | |||
| 29 | 1 | return self::addExtracerts($pem, $p12cert); |
|
| 30 | } |
||
| 31 | |||
| 80 |