1 | <?php |
||
10 | class Cookie |
||
11 | { |
||
12 | /** @var string */ |
||
13 | private $name; |
||
14 | |||
15 | /** @var string|null */ |
||
16 | private $value; |
||
17 | |||
18 | public function __construct(string $name, ?string $value = null) |
||
23 | 25 | ||
24 | 25 | public function getName() : string |
|
28 | |||
29 | public function getValue() : ?string |
||
33 | |||
34 | public function withValue(?string $value = null) : Cookie |
||
42 | |||
43 | /** |
||
44 | * Render Cookie as a string. |
||
45 | * |
||
46 | */ |
||
47 | 23 | public function __toString() : string |
|
51 | 23 | ||
52 | /** |
||
53 | 23 | * Create a Cookie. |
|
54 | * |
||
55 | */ |
||
56 | public static function create(string $name, ?string $value = null) : Cookie |
||
60 | |||
61 | 7 | /** |
|
62 | * Create a list of Cookies from a Cookie header value string. |
||
63 | 7 | * |
|
64 | * @return Cookie[] |
||
65 | */ |
||
66 | public static function listFromCookieString(string $string) : array |
||
74 | |||
75 | 4 | /** |
|
76 | * Create one Cookie from a cookie key/value header value string. |
||
77 | * |
||
78 | */ |
||
79 | public static function oneFromCookiePair(string $string) : Cookie |
||
92 | } |
||
93 |