-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHttpContext.php
More file actions
58 lines (49 loc) · 1.54 KB
/
HttpContext.php
File metadata and controls
58 lines (49 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
* This file is part of Berlioz framework.
*
* @license https://opensource.org/licenses/MIT MIT License
* @copyright 2022 Ronan GIRON
* @author Ronan GIRON <https://github.com/ElGigi>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code, to the root.
*/
declare(strict_types=1);
namespace Berlioz\Http\Client;
class HttpContext
{
public function __construct(
public string|false $proxy = false,
public bool $ssl_verify_peer = true,
public bool $ssl_verify_host = true,
public ?string $ssl_ciphers = null,
public ?string $ssl_cafile = null,
public ?string $ssl_capath = null,
public ?string $ssl_local_cert = null,
public ?string $ssl_local_pk = null,
/** @deprecated CURL < 7.17 */
public ?string $ssl_local_cert_passphrase = null,
public ?string $ssl_local_passphrase = null,
) {
}
public static function make(array|self|null $context = null, ?self $initial = null): self
{
// None defined
if (null === $context) {
if (null !== $initial) {
return clone $initial;
}
return new self();
}
// Array of options
if (is_array($context)) {
$new = null !== $initial ? clone $initial : new self();
foreach ($context as $key => $value) {
$new->$key = $value;
}
return $new;
}
return $context;
}
}