1 | <?php |
||
5 | class Reader |
||
6 | { |
||
7 | const DEFAULT_CONNECTION_TIMEOUT = 5; |
||
8 | |||
9 | const OPT_CONNECTION_TIMEOUT = 'connection_timeout'; |
||
10 | |||
11 | /** |
||
12 | * Connect to a URL and retrieve the SSL certificate. |
||
13 | * |
||
14 | * Available options: |
||
15 | * |
||
16 | * - connection_timeout: Timeout when connection to the URL, specified in seconds. |
||
17 | * |
||
18 | * @param $url |
||
19 | * @param array $options |
||
20 | * @return Certificate |
||
21 | * @throws Exception |
||
22 | */ |
||
23 | 1 | public function readFromUrl($url, $options = []) |
|
53 | |||
54 | /** |
||
55 | * @param $file |
||
56 | * @return Certificate |
||
57 | * @throws Exception |
||
58 | */ |
||
59 | 8 | public function readFromFile($file) |
|
67 | |||
68 | /** |
||
69 | * @param $certResource |
||
70 | * @return string |
||
71 | */ |
||
72 | 1 | protected function certResourceToString($certResource) |
|
80 | |||
81 | /** |
||
82 | * @param $options |
||
83 | * @return mixed |
||
84 | */ |
||
85 | 1 | protected function prepareReadFromUrlOptions($options) |
|
93 | } |
||
94 |