-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathChromiumCookie.php
49 lines (39 loc) · 1.16 KB
/
ChromiumCookie.php
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
<?php
declare(strict_types=1);
namespace Gotenberg\Modules;
use JsonSerializable;
class ChromiumCookie implements JsonSerializable
{
public function __construct(
public readonly string $name,
public readonly string $value,
public readonly string $domain,
public readonly string|null $path = null,
public readonly bool|null $secure = null,
public readonly bool|null $httpOnly = null,
public readonly string|null $sameSite = null,
) {
}
/** @return array<string, string|bool> */
public function jsonSerialize(): array
{
$serialized = [
'name' => $this->name,
'value' => $this->value,
'domain' => $this->domain,
];
if ($this->path !== null) {
$serialized['path'] = $this->path;
}
if ($this->secure !== null) {
$serialized['secure'] = $this->secure;
}
if ($this->httpOnly !== null) {
$serialized['httpOnly'] = $this->httpOnly;
}
if ($this->sameSite !== null) {
$serialized['sameSite'] = $this->sameSite;
}
return $serialized;
}
}