1 | <?php namespace Limoncello\Application\Cookies; |
||
26 | class Cookie implements CookieInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $name; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $value; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $expire; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $path; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $domain; |
||
52 | |||
53 | /** |
||
54 | * @var bool |
||
55 | */ |
||
56 | private $isSecure; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | private $isHttpOnly; |
||
62 | |||
63 | /** |
||
64 | * @var bool |
||
65 | */ |
||
66 | private $isRaw; |
||
67 | |||
68 | /** |
||
69 | * @param string $name |
||
70 | * @param string $value |
||
71 | * @param int $expire |
||
72 | * @param string $path |
||
73 | * @param string $domain |
||
74 | * @param bool $isSecure |
||
75 | * @param bool $isHttpOnly |
||
76 | * @param bool $isRaw |
||
77 | */ |
||
78 | 3 | public function __construct( |
|
99 | |||
100 | /** |
||
101 | * @inheritdoc |
||
102 | */ |
||
103 | 3 | public function getName(): string |
|
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | 3 | public function getValue(): string |
|
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | 3 | public function setValue(string $value): CookieInterface |
|
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | */ |
||
129 | 3 | public function getExpiresAtUnixTime(): int |
|
133 | |||
134 | /** |
||
135 | * @inheritdoc |
||
136 | */ |
||
137 | 3 | public function setExpiresAtUnixTime(int $unixTimestamp): CookieInterface |
|
147 | |||
148 | /** |
||
149 | * @inheritdoc |
||
150 | */ |
||
151 | 1 | public function setExpiresInSeconds(int $seconds): CookieInterface |
|
155 | |||
156 | /** |
||
157 | * @inheritdoc |
||
158 | */ |
||
159 | 1 | public function setExpiresAtDataTime(DateTimeInterface $dateTime): CookieInterface |
|
163 | |||
164 | /** |
||
165 | * @inheritdoc |
||
166 | */ |
||
167 | 3 | public function getPath(): string |
|
171 | |||
172 | /** |
||
173 | * @inheritdoc |
||
174 | */ |
||
175 | 3 | public function setPath(string $path): CookieInterface |
|
181 | |||
182 | /** |
||
183 | * @inheritdoc |
||
184 | */ |
||
185 | 3 | public function getDomain(): string |
|
189 | |||
190 | /** |
||
191 | * @inheritdoc |
||
192 | */ |
||
193 | 3 | public function setDomain(string $domain): CookieInterface |
|
199 | |||
200 | /** |
||
201 | * @inheritdoc |
||
202 | */ |
||
203 | 3 | public function isSendOnlyOverSecureConnection(): bool |
|
204 | { |
||
205 | 3 | return $this->isSecure; |
|
206 | } |
||
207 | |||
208 | /** |
||
209 | * @inheritdoc |
||
210 | */ |
||
211 | 2 | public function setSendOnlyOverSecureConnection(): CookieInterface |
|
217 | |||
218 | /** |
||
219 | * @inheritdoc |
||
220 | */ |
||
221 | 2 | public function isSendOverAnyConnection(): bool |
|
222 | { |
||
223 | 2 | return !$this->isSecure; |
|
224 | } |
||
225 | |||
226 | /** |
||
227 | * @inheritdoc |
||
228 | */ |
||
229 | 2 | public function setSendOverAnyConnection(): CookieInterface |
|
235 | |||
236 | /** |
||
237 | * @inheritdoc |
||
238 | */ |
||
239 | 3 | public function isAccessibleOnlyThroughHttp(): bool |
|
240 | { |
||
241 | 3 | return $this->isHttpOnly; |
|
242 | } |
||
243 | |||
244 | /** |
||
245 | * @inheritdoc |
||
246 | */ |
||
247 | 2 | public function setAccessibleOnlyThroughHttp(): CookieInterface |
|
253 | |||
254 | /** |
||
255 | * @inheritdoc |
||
256 | */ |
||
257 | 2 | public function isAccessibleThroughHttpAndScripts(): bool |
|
258 | { |
||
259 | 2 | return !$this->isHttpOnly; |
|
260 | } |
||
261 | |||
262 | /** |
||
263 | * @inheritdoc |
||
264 | */ |
||
265 | 2 | public function setAccessibleThroughHttpAndScripts(): CookieInterface |
|
271 | |||
272 | /** |
||
273 | * @inheritdoc |
||
274 | */ |
||
275 | 2 | public function isRaw(): bool |
|
276 | { |
||
277 | 2 | return $this->isRaw; |
|
278 | } |
||
279 | |||
280 | /** |
||
281 | * @inheritdoc |
||
282 | */ |
||
283 | 3 | public function setAsRaw(): CookieInterface |
|
289 | |||
290 | /** |
||
291 | * @inheritdoc |
||
292 | */ |
||
293 | 3 | public function isNotRaw(): bool |
|
294 | { |
||
295 | 3 | return !$this->isRaw; |
|
296 | } |
||
297 | |||
298 | /** |
||
299 | * @inheritdoc |
||
300 | */ |
||
301 | 2 | public function setAsNotRaw(): CookieInterface |
|
307 | } |
||
308 |