1 | <?php |
||
6 | class CHttpGet |
||
7 | { |
||
8 | private $request = array(); |
||
9 | private $response = array(); |
||
10 | |||
11 | |||
12 | |||
13 | /** |
||
14 | * Constructor |
||
15 | * |
||
16 | */ |
||
17 | public function __construct() |
||
21 | |||
22 | |||
23 | |||
24 | /** |
||
25 | * Build an encoded url. |
||
26 | * |
||
27 | * @param string $baseUrl This is the original url which will be merged. |
||
28 | * @param string $merge Thse parts should be merged into the baseUrl, |
||
29 | * the format is as parse_url. |
||
30 | * |
||
31 | * @return string $url as the modified url. |
||
32 | */ |
||
33 | public function buildUrl($baseUrl, $merge) |
||
48 | |||
49 | |||
50 | |||
51 | /** |
||
52 | * Set the url for the request. |
||
53 | * |
||
54 | * @param string $url |
||
55 | * |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function setUrl($url) |
||
75 | |||
76 | |||
77 | |||
78 | /** |
||
79 | * Set custom header field for the request. |
||
80 | * |
||
81 | * @param string $field |
||
82 | * @param string $value |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function setHeader($field, $value) |
||
91 | |||
92 | |||
93 | |||
94 | /** |
||
95 | * Set header fields for the request. |
||
96 | * |
||
97 | * @param string $field |
||
98 | * @param string $value |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function parseHeader() |
||
127 | |||
128 | |||
129 | |||
130 | /** |
||
131 | * Perform the request. |
||
132 | * |
||
133 | * @param boolean $debug set to true to dump headers. |
||
134 | * |
||
135 | * @throws Exception when curl fails to retrieve url. |
||
136 | * |
||
137 | * @return boolean |
||
138 | */ |
||
139 | public function doGet($debug = false) |
||
178 | |||
179 | |||
180 | |||
181 | /** |
||
182 | * Get HTTP code of response. |
||
183 | * |
||
184 | * @return integer as HTTP status code or null if not available. |
||
185 | */ |
||
186 | public function getStatus() |
||
192 | |||
193 | |||
194 | |||
195 | /** |
||
196 | * Get file modification time of response. |
||
197 | * |
||
198 | * @return int as timestamp. |
||
199 | */ |
||
200 | public function getLastModified() |
||
206 | |||
207 | |||
208 | |||
209 | /** |
||
210 | * Get content type. |
||
211 | * |
||
212 | * @return string as the content type or null if not existing or invalid. |
||
213 | */ |
||
214 | public function getContentType() |
||
224 | |||
225 | |||
226 | |||
227 | /** |
||
228 | * Get file modification time of response. |
||
229 | * |
||
230 | * @param mixed $default as default value (int seconds) if date is |
||
231 | * missing in response header. |
||
232 | * |
||
233 | * @return int as timestamp or $default if Date is missing in |
||
234 | * response header. |
||
235 | */ |
||
236 | public function getDate($default = false) |
||
242 | |||
243 | |||
244 | |||
245 | /** |
||
246 | * Get max age of cachable item. |
||
247 | * |
||
248 | * @param mixed $default as default value if date is missing in response |
||
249 | * header. |
||
250 | * |
||
251 | * @return int as timestamp or false if not available. |
||
252 | */ |
||
253 | public function getMaxAge($default = false) |
||
278 | |||
279 | |||
280 | |||
281 | /** |
||
282 | * Get body of response. |
||
283 | * |
||
284 | * @return string as body. |
||
285 | */ |
||
286 | public function getBody() |
||
290 | } |
||
291 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: