Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cookie.php
1<?php
2
10namespace Bitrix\Main\Web\Http;
11
12class Cookie
13{
14 public const SAME_SITE_NONE = 'None';
15 public const SAME_SITE_LAX = 'Lax';
16 public const SAME_SITE_STRICT = 'Strict';
17
18 protected $domain;
19 protected $expires;
20 protected $httpOnly = true;
21 protected $name;
22 protected $path = '/';
23 protected $secure = false;
24 protected $value;
25 protected $sameSite;
26
33 public function __construct(string $name, ?string $value, int $expires = 0)
34 {
35 $this->name = $name;
36 $this->value = $value;
37 $this->expires = $expires;
38 }
39
40 public function setDomain(string $domain): Cookie
41 {
42 $this->domain = $domain;
43 return $this;
44 }
45
46 public function getDomain(): ?string
47 {
48 return $this->domain;
49 }
50
51 public function setExpires(int $expires): Cookie
52 {
53 $this->expires = $expires;
54 return $this;
55 }
56
57 public function getExpires(): int
58 {
59 return $this->expires;
60 }
61
62 public function setHttpOnly(bool $httpOnly): Cookie
63 {
64 $this->httpOnly = $httpOnly;
65 return $this;
66 }
67
68 public function getHttpOnly(): bool
69 {
70 return $this->httpOnly;
71 }
72
73 public function setName(string $name): Cookie
74 {
75 $this->name = $name;
76 return $this;
77 }
78
79 public function getName(): string
80 {
81 return $this->name;
82 }
83
84 public function setPath(string $path): Cookie
85 {
86 $this->path = $path;
87 return $this;
88 }
89
90 public function getPath(): string
91 {
92 return $this->path;
93 }
94
95 public function setSecure(bool $secure): Cookie
96 {
97 $this->secure = $secure;
98 return $this;
99 }
100
101 public function getSecure(): bool
102 {
103 return $this->secure;
104 }
105
106 public function setValue(?string $value): Cookie
107 {
108 $this->value = $value;
109 return $this;
110 }
111
112 public function getValue(): ?string
113 {
114 return $this->value;
115 }
116
117 public function setSameSite(?string $sameSite): Cookie
118 {
119 $this->sameSite = $sameSite;
120 return $this;
121 }
122
123 public function getSameSite(): ?string
124 {
125 return $this->sameSite;
126 }
127}