1 | <?php |
||
23 | class CurlConfiguration { |
||
24 | |||
25 | /** |
||
26 | * Allow encoding. |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $allowEncoding; |
||
31 | |||
32 | /** |
||
33 | * HTTP connect timeout. |
||
34 | * |
||
35 | * @var int |
||
36 | */ |
||
37 | private $connectTimeout; |
||
38 | |||
39 | /** |
||
40 | * Debug. |
||
41 | * |
||
42 | * @var bool |
||
43 | */ |
||
44 | private $debug; |
||
45 | |||
46 | /** |
||
47 | * Debug file. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $debugFile; |
||
52 | |||
53 | /** |
||
54 | * Headers. |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | private $headers; |
||
59 | |||
60 | /** |
||
61 | * Host. |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $host; |
||
66 | |||
67 | /** |
||
68 | * HTTP basic password. |
||
69 | * |
||
70 | * @var string |
||
71 | */ |
||
72 | private $httpPassword; |
||
73 | |||
74 | /** |
||
75 | * HTTP basic username. |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | private $httpUsername; |
||
80 | |||
81 | /** |
||
82 | * Proxy host. |
||
83 | * |
||
84 | * @var string |
||
85 | */ |
||
86 | private $proxyHost; |
||
87 | |||
88 | /** |
||
89 | * Proxy password. |
||
90 | * |
||
91 | * @var string |
||
92 | */ |
||
93 | private $proxyPassword; |
||
94 | |||
95 | /** |
||
96 | * Proxy port. |
||
97 | * |
||
98 | * @var int |
||
99 | */ |
||
100 | private $proxyPort; |
||
101 | |||
102 | /** |
||
103 | * Proxy type. |
||
104 | * |
||
105 | * @var int |
||
106 | */ |
||
107 | private $proxyType; |
||
108 | |||
109 | /** |
||
110 | * Proxy username. |
||
111 | * |
||
112 | * @var string |
||
113 | */ |
||
114 | private $proxyUsername; |
||
115 | |||
116 | /** |
||
117 | * HTTP request timeout. |
||
118 | * |
||
119 | * @var int |
||
120 | */ |
||
121 | private $requestTimeout; |
||
122 | |||
123 | /** |
||
124 | * SSL verification. |
||
125 | * |
||
126 | * @var bool |
||
127 | */ |
||
128 | private $sslVerification; |
||
129 | |||
130 | /** |
||
131 | * User agent. |
||
132 | * |
||
133 | * @var string |
||
134 | */ |
||
135 | private $userAgent; |
||
136 | |||
137 | /** |
||
138 | * Verbose. |
||
139 | * |
||
140 | * @var bool |
||
141 | */ |
||
142 | private $verbose; |
||
143 | |||
144 | /** |
||
145 | * Constructor. |
||
146 | */ |
||
147 | public function __construct() { |
||
158 | |||
159 | /** |
||
160 | * Add an header. |
||
161 | * |
||
162 | * @param string $name The header name. |
||
163 | * @param string $value The header value. |
||
164 | * @return CurlConfiguration Returns this cURL configuration. |
||
165 | * @throws StringArgumentException Throws a string argument exception if the argument is not a string. |
||
166 | */ |
||
167 | public function addHeader($name, $value) { |
||
172 | |||
173 | /** |
||
174 | * Clear the headers. |
||
175 | * |
||
176 | * @return CurlConfiguration Returns this cURL configuration. |
||
177 | */ |
||
178 | public function clearHeaders() { |
||
181 | |||
182 | /** |
||
183 | * Get the allow encoding. |
||
184 | * |
||
185 | * @return bool Returns the allow encoding. |
||
186 | */ |
||
187 | public function getAllowEncoding() { |
||
190 | |||
191 | /** |
||
192 | * Get the connect timeout. |
||
193 | * |
||
194 | * @return int Returns the connect timeout. |
||
195 | */ |
||
196 | public function getConnectTimeout() { |
||
199 | |||
200 | /** |
||
201 | * Ge the debug. |
||
202 | * |
||
203 | * @return bool Returns the debug. |
||
204 | */ |
||
205 | public function getDebug() { |
||
208 | |||
209 | /** |
||
210 | * Get the debug file. |
||
211 | * |
||
212 | * @return string Returns the debug file. |
||
213 | */ |
||
214 | public function getDebugFile() { |
||
217 | |||
218 | /** |
||
219 | * Get the headers. |
||
220 | * |
||
221 | * @return array Returns the headers. |
||
222 | */ |
||
223 | public function getHeaders() { |
||
226 | |||
227 | /** |
||
228 | * Get the host. |
||
229 | * |
||
230 | * @return string Returns the host. |
||
231 | */ |
||
232 | public function getHost() { |
||
235 | |||
236 | /** |
||
237 | * Get the HTTP password. |
||
238 | * |
||
239 | * @return string Returns the HTTP password. |
||
240 | */ |
||
241 | public function getHttpPassword() { |
||
244 | |||
245 | /** |
||
246 | * Get the HTTP username. |
||
247 | * |
||
248 | * @return string Returns the HTTP username. |
||
249 | */ |
||
250 | public function getHttpUsername() { |
||
253 | |||
254 | /** |
||
255 | * Get the proxy host. |
||
256 | * |
||
257 | * @return string Returns the proxy host. |
||
258 | */ |
||
259 | public function getProxyHost() { |
||
262 | |||
263 | /** |
||
264 | * Get the proxy password. |
||
265 | * |
||
266 | * @return string Returns the proxy password. |
||
267 | */ |
||
268 | public function getProxyPassword() { |
||
271 | |||
272 | /** |
||
273 | * Get the proxy port. |
||
274 | * |
||
275 | * @return int Returns the proxy port. |
||
276 | */ |
||
277 | public function getProxyPort() { |
||
280 | |||
281 | /** |
||
282 | * Get the proxy type. |
||
283 | * |
||
284 | * @return int Returns the proxy type. |
||
285 | */ |
||
286 | public function getProxyType() { |
||
289 | |||
290 | /** |
||
291 | * Get the proxy username. |
||
292 | * |
||
293 | * @return string Returns the proxy username. |
||
294 | */ |
||
295 | public function getProxyUsername() { |
||
298 | |||
299 | /** |
||
300 | * Get the request timeout. |
||
301 | * |
||
302 | * @return int Returns the request timeout. |
||
303 | */ |
||
304 | public function getRequestTimeout() { |
||
307 | |||
308 | /** |
||
309 | * Get the SSL verification. |
||
310 | * |
||
311 | * @return bool Returns the SSL verification. |
||
312 | */ |
||
313 | public function getSslVerification() { |
||
316 | |||
317 | /** |
||
318 | * Get the user agent. |
||
319 | * |
||
320 | * @return string Returns the user agent. |
||
321 | */ |
||
322 | public function getUserAgent() { |
||
325 | |||
326 | /** |
||
327 | * Get the verbose. |
||
328 | * |
||
329 | * @return bool Returns the verbose. |
||
330 | */ |
||
331 | public function getVerbose() { |
||
334 | |||
335 | /** |
||
336 | * Remove an header. |
||
337 | * |
||
338 | * @param string $name The header name. |
||
339 | * @return void |
||
340 | */ |
||
341 | public function removeHeader($name) { |
||
346 | |||
347 | /** |
||
348 | * Set the allow encoding. |
||
349 | * |
||
350 | * @param bool $allowEncoding The allow encoding. |
||
351 | * @return CurlConfiguration Returns this cURL configuration. |
||
352 | */ |
||
353 | public function setAllowEncoding($allowEncoding) { |
||
357 | |||
358 | /** |
||
359 | * Set the connect timeout. |
||
360 | * |
||
361 | * @param int $connectTimeout The connect timeout. |
||
362 | * @return CurlConfiguration Returns this cURL configuration. |
||
363 | */ |
||
364 | public function setConnectTimeout($connectTimeout) { |
||
368 | |||
369 | /** |
||
370 | * Set the debug. |
||
371 | * |
||
372 | * @param bool $debug The debug. |
||
373 | * @return CurlConfiguration Returns this cURL configuration. |
||
374 | */ |
||
375 | public function setDebug($debug) { |
||
379 | |||
380 | /** |
||
381 | * Set the debug file. |
||
382 | * |
||
383 | * @param string $debugFile The debug file. |
||
384 | * @return CurlConfiguration Returns this cURL configuration. |
||
385 | */ |
||
386 | public function setDebugFile($debugFile) { |
||
390 | |||
391 | /** |
||
392 | * Set the headers. |
||
393 | * |
||
394 | * @param array $headers The headers |
||
395 | * @return CurlConfiguration Returns this cURL configuration. |
||
396 | */ |
||
397 | protected function setHeaders(array $headers) { |
||
401 | |||
402 | /** |
||
403 | * Set the host. |
||
404 | * |
||
405 | * @param string $host The host. |
||
406 | * @return CurlConfiguration Returns this cURL configuration. |
||
407 | */ |
||
408 | public function setHost($host) { |
||
412 | |||
413 | /** |
||
414 | * Set the HTTP basic password. |
||
415 | * |
||
416 | * @param string $httpPassword The HTTP basic password. |
||
417 | * @return CurlConfiguration Returns this cURL configuration. |
||
418 | */ |
||
419 | public function setHttpPassword($httpPassword) { |
||
423 | |||
424 | /** |
||
425 | * Set the HTTP basic username. |
||
426 | * |
||
427 | * @param string $httpUsername The HTTP basic username. |
||
428 | * @return CurlConfiguration Returns this cURL configuration. |
||
429 | */ |
||
430 | public function setHttpUsername($httpUsername) { |
||
434 | |||
435 | /** |
||
436 | * Set the proxy host. |
||
437 | * |
||
438 | * @param string $proxyHost The proxy host. |
||
439 | * @return CurlConfiguration Returns this cURL configuration. |
||
440 | */ |
||
441 | public function setProxyHost($proxyHost) { |
||
445 | |||
446 | /** |
||
447 | * Set the proxy password. |
||
448 | * |
||
449 | * @param string $proxyPassword The proxy password. |
||
450 | * @return CurlConfiguration Returns this cURL configuration. |
||
451 | */ |
||
452 | public function setProxyPassword($proxyPassword) { |
||
456 | |||
457 | /** |
||
458 | * Set the proxy port. |
||
459 | * |
||
460 | * @param int $proxyPort The proxy port. |
||
461 | * @return CurlConfiguration Returns this cURL configuration. |
||
462 | */ |
||
463 | public function setProxyPort($proxyPort) { |
||
467 | |||
468 | /** |
||
469 | * Set the proxy type. |
||
470 | * |
||
471 | * @param int $proxyType The proxy type. |
||
472 | * @return CurlConfiguration Returns this cURL configuration. |
||
473 | */ |
||
474 | public function setProxyType($proxyType) { |
||
478 | |||
479 | /** |
||
480 | * Set the proxy username. |
||
481 | * |
||
482 | * @param string $proxyUsername The proxy username. |
||
483 | * @return CurlConfiguration Returns this cURL configuration. |
||
484 | */ |
||
485 | public function setProxyUsername($proxyUsername) { |
||
489 | |||
490 | /** |
||
491 | * Set the request timeout. |
||
492 | * |
||
493 | * @param int $requestTimeout The request timeout. |
||
494 | * @return CurlConfiguration Returns this cURL configuration. |
||
495 | */ |
||
496 | public function setRequestTimeout($requestTimeout) { |
||
500 | |||
501 | /** |
||
502 | * Set the SSL verification. |
||
503 | * |
||
504 | * @param bool $sslVerification The SSL verification. |
||
505 | * @return CurlConfiguration Returns this cURL configuration. |
||
506 | */ |
||
507 | public function setSslVerification($sslVerification) { |
||
511 | |||
512 | /** |
||
513 | * Set the user agent. |
||
514 | * |
||
515 | * @param string $userAgent The user agent. |
||
516 | * @return CurlConfiguration Returns this cURL configuration. |
||
517 | */ |
||
518 | public function setUserAgent($userAgent) { |
||
522 | |||
523 | /** |
||
524 | * Set the verbose. |
||
525 | * |
||
526 | * @param bool $verbose The verbose. |
||
527 | * @return CurlConfiguration Returns this cURL configuration. |
||
528 | */ |
||
529 | public function setVerbose($verbose = false) { |
||
533 | } |
||
534 |