| @@ 91-98 (lines=8) @@ | ||
| 88 | * @throws \RuntimeException If file reading fails |
|
| 89 | * @return self |
|
| 90 | */ |
|
| 91 | public static function fromFile($filename) |
|
| 92 | { |
|
| 93 | if (!is_readable($filename) || |
|
| 94 | false === ($str = file_get_contents($filename))) { |
|
| 95 | throw new \RuntimeException("Failed to read $filename."); |
|
| 96 | } |
|
| 97 | return self::fromString($str); |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Get content type. |
|
| @@ 61-68 (lines=8) @@ | ||
| 58 | * @throws \RuntimeException If file reading fails |
|
| 59 | * @return self |
|
| 60 | */ |
|
| 61 | public static function fromFile($filename) |
|
| 62 | { |
|
| 63 | if (!is_readable($filename) || |
|
| 64 | false === ($str = file_get_contents($filename))) { |
|
| 65 | throw new \RuntimeException("Failed to read $filename."); |
|
| 66 | } |
|
| 67 | return self::fromString($str); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Get self with PEM objects appended. |
|