1 | <?php |
||
5 | class Reader |
||
6 | { |
||
7 | /** |
||
8 | * Default connection timeout in seconds. |
||
9 | */ |
||
10 | const DEFAULT_CONNECTION_TIMEOUT = 5; |
||
11 | |||
12 | /** |
||
13 | * Default port on which to expect https. |
||
14 | */ |
||
15 | const DEFAULT_PORT = 443; |
||
16 | |||
17 | /** |
||
18 | * Option Flag: Name of option for defining a connection timeout. |
||
19 | */ |
||
20 | const OPT_CONNECTION_TIMEOUT = 'connection_timeout'; |
||
21 | |||
22 | /** |
||
23 | * Connect to a URL and retrieve the SSL certificate. |
||
24 | * |
||
25 | * Available options: |
||
26 | * |
||
27 | * - connection_timeout: Timeout when connection to the URL, specified in seconds. |
||
28 | * |
||
29 | * @param $url |
||
30 | * @param array $options |
||
31 | * @return Certificate |
||
32 | * @throws Exception |
||
33 | */ |
||
34 | 1 | public function readFromUrl($url, array $options = []): Certificate |
|
80 | |||
81 | /** |
||
82 | * @param $file |
||
83 | * @return Certificate |
||
84 | * @throws Exception |
||
85 | */ |
||
86 | 13 | public function readFromFile($file): Certificate |
|
94 | |||
95 | /** |
||
96 | * @param $certResource |
||
97 | * @return string |
||
98 | */ |
||
99 | 1 | protected function certResourceToString($certResource): string |
|
107 | |||
108 | /** |
||
109 | * @param $options |
||
110 | * @return array |
||
111 | */ |
||
112 | 1 | protected function prepareReadFromUrlOptions(array $options): array |
|
120 | } |
||
121 |