1 | <?php declare(strict_types = 1); |
||
12 | class Cookie implements CookieContract |
||
13 | { |
||
14 | protected $domain; |
||
15 | |||
16 | protected $expire; |
||
17 | |||
18 | protected $httpOnly; |
||
19 | |||
20 | protected $name; |
||
21 | |||
22 | protected $path; |
||
23 | |||
24 | protected $secure; |
||
25 | |||
26 | protected $value; |
||
27 | |||
28 | /** |
||
29 | * Cookie constructor. |
||
30 | * |
||
31 | * @param $name |
||
32 | * @param null $value |
||
33 | * @param int $expire |
||
34 | * @param string $path |
||
35 | * @param null $domain |
||
36 | * @param bool $secure |
||
37 | * @param bool $httpOnly |
||
38 | */ |
||
39 | 14 | public function __construct( |
|
75 | |||
76 | 2 | public static function createFromString(string $cookie) |
|
87 | |||
88 | /** |
||
89 | * @param $string |
||
90 | * @return int timestamp |
||
91 | */ |
||
92 | 1 | public static function inDateInterval(string $string) |
|
96 | |||
97 | /** |
||
98 | * @param $days |
||
99 | * @return int timestamp |
||
100 | */ |
||
101 | 2 | public static function inDays($days) |
|
105 | |||
106 | /** |
||
107 | * @param $hours |
||
108 | * @return int timestamp |
||
109 | */ |
||
110 | 1 | public static function inHours($hours) |
|
114 | |||
115 | /** |
||
116 | * @param $minutes |
||
117 | * @return int timestamp |
||
118 | */ |
||
119 | 4 | public static function inMinutes($minutes) |
|
123 | |||
124 | /** |
||
125 | * @param $months |
||
126 | * @return int timestamp |
||
127 | */ |
||
128 | 1 | public static function inMonths($months) |
|
132 | |||
133 | /** |
||
134 | * @param $days |
||
135 | * @return int timestamp |
||
136 | */ |
||
137 | 1 | public static function inWeeks($days) |
|
143 | |||
144 | /** |
||
145 | * @return int timestamp |
||
146 | */ |
||
147 | 2 | public static function outdated() |
|
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | 8 | public function __toString() |
|
187 | |||
188 | public function asPlainText() |
||
192 | |||
193 | /** |
||
194 | * @return string |
||
195 | */ |
||
196 | 8 | public function getDomain() |
|
200 | |||
201 | /** |
||
202 | * @return int|string timestamp |
||
203 | */ |
||
204 | 9 | public function getExpireTime() |
|
208 | |||
209 | /** |
||
210 | * @return string |
||
211 | */ |
||
212 | 8 | public function getName() |
|
216 | |||
217 | /** |
||
218 | * @return string|null |
||
219 | */ |
||
220 | 8 | public function getValue() |
|
224 | |||
225 | /** |
||
226 | * @return bool |
||
227 | */ |
||
228 | 8 | public function isHttpOnly() |
|
232 | |||
233 | /** |
||
234 | * @return bool |
||
235 | */ |
||
236 | 8 | public function isSecure() |
|
240 | } |