1 | <?php |
||
23 | class CurlConfiguration { |
||
24 | |||
25 | use BooleanDebugTrait; |
||
26 | use BooleanVerboseTrait; |
||
27 | |||
28 | /** |
||
29 | * Allow encoding. |
||
30 | * |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $allowEncoding; |
||
34 | |||
35 | /** |
||
36 | * Connect timeout. |
||
37 | * |
||
38 | * @var int |
||
39 | */ |
||
40 | private $connectTimeout; |
||
41 | |||
42 | /** |
||
43 | * Debug file. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private $debugFile; |
||
48 | |||
49 | /** |
||
50 | * Headers. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private $headers; |
||
55 | |||
56 | /** |
||
57 | * Host. |
||
58 | * |
||
59 | * @var string|null |
||
60 | */ |
||
61 | private $host; |
||
62 | |||
63 | /** |
||
64 | * HTTP basic password. |
||
65 | * |
||
66 | * @var string|null |
||
67 | */ |
||
68 | private $httpPassword; |
||
69 | |||
70 | /** |
||
71 | * HTTP basic username. |
||
72 | * |
||
73 | * @var string|null |
||
74 | */ |
||
75 | private $httpUsername; |
||
76 | |||
77 | /** |
||
78 | * Proxy host. |
||
79 | * |
||
80 | * @var string|null |
||
81 | */ |
||
82 | private $proxyHost; |
||
83 | |||
84 | /** |
||
85 | * Proxy password. |
||
86 | * |
||
87 | * @var string|null |
||
88 | */ |
||
89 | private $proxyPassword; |
||
90 | |||
91 | /** |
||
92 | * Proxy port. |
||
93 | * |
||
94 | * @var int|null |
||
95 | */ |
||
96 | private $proxyPort; |
||
97 | |||
98 | /** |
||
99 | * Proxy type. |
||
100 | * |
||
101 | * @var int|null |
||
102 | */ |
||
103 | private $proxyType; |
||
104 | |||
105 | /** |
||
106 | * Proxy username. |
||
107 | * |
||
108 | * @var string|null |
||
109 | */ |
||
110 | private $proxyUsername; |
||
111 | |||
112 | /** |
||
113 | * HTTP request timeout. |
||
114 | * |
||
115 | * @var int |
||
116 | */ |
||
117 | private $requestTimeout; |
||
118 | |||
119 | /** |
||
120 | * SSL verification. |
||
121 | * |
||
122 | * @var bool |
||
123 | */ |
||
124 | private $sslVerification; |
||
125 | |||
126 | /** |
||
127 | * User agent. |
||
128 | * |
||
129 | * @var string |
||
130 | */ |
||
131 | private $userAgent; |
||
132 | |||
133 | /** |
||
134 | * Constructor. |
||
135 | */ |
||
136 | public function __construct() { |
||
147 | |||
148 | /** |
||
149 | * Add an header. |
||
150 | * |
||
151 | * @param string $name The header name. |
||
152 | * @param string $value The header value. |
||
153 | * @return CurlConfiguration Returns this cURL configuration. |
||
154 | */ |
||
155 | public function addHeader(string $name, string $value): CurlConfiguration { |
||
159 | |||
160 | /** |
||
161 | * Clear the headers. |
||
162 | * |
||
163 | * @return CurlConfiguration Returns this cURL configuration. |
||
164 | */ |
||
165 | public function clearHeaders(): CurlConfiguration { |
||
168 | |||
169 | /** |
||
170 | * Get the allow encoding. |
||
171 | * |
||
172 | * @return bool Returns the allow encoding. |
||
173 | */ |
||
174 | public function getAllowEncoding(): bool { |
||
177 | |||
178 | /** |
||
179 | * Get the connect timeout. |
||
180 | * |
||
181 | * @return int Returns the connect timeout. |
||
182 | */ |
||
183 | public function getConnectTimeout(): int { |
||
186 | |||
187 | /** |
||
188 | * Get the debug file. |
||
189 | * |
||
190 | * @return string Returns the debug file. |
||
191 | */ |
||
192 | public function getDebugFile(): string { |
||
195 | |||
196 | /** |
||
197 | * Get the headers. |
||
198 | * |
||
199 | * @return array Returns the headers. |
||
200 | */ |
||
201 | public function getHeaders(): array { |
||
204 | |||
205 | /** |
||
206 | * Get the host. |
||
207 | * |
||
208 | * @return string|null Returns the host. |
||
209 | */ |
||
210 | public function getHost(): ?string { |
||
213 | |||
214 | /** |
||
215 | * Get the HTTP password. |
||
216 | * |
||
217 | * @return string|null Returns the HTTP password. |
||
218 | */ |
||
219 | public function getHttpPassword(): ?string { |
||
222 | |||
223 | /** |
||
224 | * Get the HTTP username. |
||
225 | * |
||
226 | * @return string|null Returns the HTTP username. |
||
227 | */ |
||
228 | public function getHttpUsername(): ?string { |
||
231 | |||
232 | /** |
||
233 | * Get the proxy host. |
||
234 | * |
||
235 | * @return string|null Returns the proxy host. |
||
236 | */ |
||
237 | public function getProxyHost(): ?string { |
||
240 | |||
241 | /** |
||
242 | * Get the proxy password. |
||
243 | * |
||
244 | * @return string|null Returns the proxy password. |
||
245 | */ |
||
246 | public function getProxyPassword(): ?string { |
||
249 | |||
250 | /** |
||
251 | * Get the proxy port. |
||
252 | * |
||
253 | * @return int|null Returns the proxy port. |
||
254 | */ |
||
255 | public function getProxyPort(): ?int { |
||
258 | |||
259 | /** |
||
260 | * Get the proxy type. |
||
261 | * |
||
262 | * @return int|null Returns the proxy type. |
||
263 | */ |
||
264 | public function getProxyType(): ?int { |
||
267 | |||
268 | /** |
||
269 | * Get the proxy username. |
||
270 | * |
||
271 | * @return string|null Returns the proxy username. |
||
272 | */ |
||
273 | public function getProxyUsername(): ?string { |
||
276 | |||
277 | /** |
||
278 | * Get the request timeout. |
||
279 | * |
||
280 | * @return int Returns the request timeout. |
||
281 | */ |
||
282 | public function getRequestTimeout(): int { |
||
285 | |||
286 | /** |
||
287 | * Get the SSL verification. |
||
288 | * |
||
289 | * @return bool Returns the SSL verification. |
||
290 | */ |
||
291 | public function getSslVerification(): bool { |
||
294 | |||
295 | /** |
||
296 | * Get the user agent. |
||
297 | * |
||
298 | * @return string Returns the user agent. |
||
299 | */ |
||
300 | public function getUserAgent(): string { |
||
303 | |||
304 | /** |
||
305 | * Remove an header. |
||
306 | * |
||
307 | * @param string $name The header name. |
||
308 | * @return void |
||
309 | */ |
||
310 | public function removeHeader(string $name): void { |
||
315 | |||
316 | /** |
||
317 | * Set the allow encoding. |
||
318 | * |
||
319 | * @param bool $allowEncoding The allow encoding. |
||
320 | * @return CurlConfiguration Returns this cURL configuration. |
||
321 | */ |
||
322 | public function setAllowEncoding(bool $allowEncoding): CurlConfiguration { |
||
326 | |||
327 | /** |
||
328 | * Set the connect timeout. |
||
329 | * |
||
330 | * @param int $connectTimeout The connect timeout. |
||
331 | * @return CurlConfiguration Returns this cURL configuration. |
||
332 | */ |
||
333 | public function setConnectTimeout(int $connectTimeout): CurlConfiguration { |
||
337 | |||
338 | /** |
||
339 | * Set the debug file. |
||
340 | * |
||
341 | * @param string $debugFile The debug file. |
||
342 | * @return CurlConfiguration Returns this cURL configuration. |
||
343 | */ |
||
344 | public function setDebugFile(string $debugFile): CurlConfiguration { |
||
348 | |||
349 | /** |
||
350 | * Set the headers. |
||
351 | * |
||
352 | * @param array $headers The headers |
||
353 | * @return CurlConfiguration Returns this cURL configuration. |
||
354 | */ |
||
355 | protected function setHeaders(array $headers): CurlConfiguration { |
||
359 | |||
360 | /** |
||
361 | * Set the host. |
||
362 | * |
||
363 | * @param string $host The host. |
||
364 | * @return CurlConfiguration Returns this cURL configuration. |
||
365 | */ |
||
366 | public function setHost(string $host): CurlConfiguration { |
||
370 | |||
371 | /** |
||
372 | * Set the HTTP basic password. |
||
373 | * |
||
374 | * @param string|null $httpPassword The HTTP basic password. |
||
375 | * @return CurlConfiguration Returns this cURL configuration. |
||
376 | */ |
||
377 | public function setHttpPassword(?string $httpPassword): CurlConfiguration { |
||
381 | |||
382 | /** |
||
383 | * Set the HTTP basic username. |
||
384 | * |
||
385 | * @param string|null $httpUsername The HTTP basic username. |
||
386 | * @return CurlConfiguration Returns this cURL configuration. |
||
387 | */ |
||
388 | public function setHttpUsername(?string $httpUsername): CurlConfiguration { |
||
392 | |||
393 | /** |
||
394 | * Set the proxy host. |
||
395 | * |
||
396 | * @param string|null $proxyHost The proxy host. |
||
397 | * @return CurlConfiguration Returns this cURL configuration. |
||
398 | */ |
||
399 | public function setProxyHost(?string $proxyHost): CurlConfiguration { |
||
403 | |||
404 | /** |
||
405 | * Set the proxy password. |
||
406 | * |
||
407 | * @param string|null $proxyPassword The proxy password. |
||
408 | * @return CurlConfiguration Returns this cURL configuration. |
||
409 | */ |
||
410 | public function setProxyPassword(?string $proxyPassword): CurlConfiguration { |
||
414 | |||
415 | /** |
||
416 | * Set the proxy port. |
||
417 | * |
||
418 | * @param int|null $proxyPort The proxy port. |
||
419 | * @return CurlConfiguration Returns this cURL configuration. |
||
420 | */ |
||
421 | public function setProxyPort(?int $proxyPort): CurlConfiguration { |
||
425 | |||
426 | /** |
||
427 | * Set the proxy type. |
||
428 | * |
||
429 | * @param int|null $proxyType The proxy type. |
||
430 | * @return CurlConfiguration Returns this cURL configuration. |
||
431 | */ |
||
432 | public function setProxyType(?int $proxyType): CurlConfiguration { |
||
436 | |||
437 | /** |
||
438 | * Set the proxy username. |
||
439 | * |
||
440 | * @param string|null $proxyUsername The proxy username. |
||
441 | * @return CurlConfiguration Returns this cURL configuration. |
||
442 | */ |
||
443 | public function setProxyUsername(?string $proxyUsername): CurlConfiguration { |
||
447 | |||
448 | /** |
||
449 | * Set the request timeout. |
||
450 | * |
||
451 | * @param int $requestTimeout The request timeout. |
||
452 | * @return CurlConfiguration Returns this cURL configuration. |
||
453 | */ |
||
454 | public function setRequestTimeout(int $requestTimeout): CurlConfiguration { |
||
458 | |||
459 | /** |
||
460 | * Set the SSL verification. |
||
461 | * |
||
462 | * @param bool $sslVerification The SSL verification. |
||
463 | * @return CurlConfiguration Returns this cURL configuration. |
||
464 | */ |
||
465 | public function setSslVerification(bool $sslVerification): CurlConfiguration { |
||
469 | |||
470 | /** |
||
471 | * Set the user agent. |
||
472 | * |
||
473 | * @param string $userAgent The user agent. |
||
474 | * @return CurlConfiguration Returns this cURL configuration. |
||
475 | */ |
||
476 | public function setUserAgent(string $userAgent): CurlConfiguration { |
||
480 | } |
||
481 |