1 | <?php |
||
26 | class StreamContext implements StreamContextInterface |
||
27 | { |
||
28 | /** |
||
29 | * Constructs the stream context object |
||
30 | * |
||
31 | * @param array $defaultOptions The default options to instantiate the context with |
||
32 | */ |
||
33 | public function __construct(array $defaultOptions = array()) |
||
38 | |||
39 | /** |
||
40 | * Sets an options to the internal resource context object |
||
41 | * |
||
42 | * @param string $wrapper The wrapper section of the option |
||
43 | * @param string $option The option key |
||
44 | * @param mixed $value The value to set for option in specific wrapper section |
||
45 | * |
||
46 | * @return bool true on success or false on failure |
||
47 | */ |
||
48 | public function setOption($wrapper, $option, $value) |
||
52 | |||
53 | /** |
||
54 | * Returns an specific options in certain wrapper section |
||
55 | * |
||
56 | * @param unknown $wrapper The wrapper section of the option |
||
57 | * @param unknown $option The option key to get the value for |
||
58 | * |
||
59 | * @return mixed The options value null if nothing exists |
||
60 | */ |
||
61 | public function getOption($wrapper, $option) |
||
70 | |||
71 | /** |
||
72 | * Returns all options set on internal stream context resource |
||
73 | * |
||
74 | * @return array all options |
||
75 | */ |
||
76 | public function getOptions() |
||
80 | |||
81 | /** |
||
82 | * Adds a server ssl certificate for specific domain using the sni feature |
||
83 | * |
||
84 | * @param string $domain The domain for the certificate to use |
||
85 | * @param string $certPath The path to the bundled certificate file |
||
86 | * @param bool $overwrite If an existing domain entry should be overwritten or not |
||
87 | * |
||
88 | * @return bool true on success or false on failure |
||
89 | */ |
||
90 | public function addSniServerCert($domain, $certPath, $overwrite = true) |
||
129 | |||
130 | /** |
||
131 | * Returns the internal php stream context resource for php stream usage compatibility |
||
132 | * |
||
133 | * @return resource |
||
134 | */ |
||
135 | public function getResource() |
||
139 | } |
||
140 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: