-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCookiesInterface.php
executable file
·80 lines (69 loc) · 2 KB
/
CookiesInterface.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
namespace MaplePHP\Http\Interfaces;
interface CookiesInterface
{
/**
* Set cookie allowed path
* @param string $path URI Path
* @return self
*/
public function setPath(string $path): self;
/**
* Set cookie allowed domain
* @param string $domain URI Path
* @return self
*/
public function setDomain(string $domain): self;
/**
* Set cookie secure flag (HTTPS only: true)
* @param bool $secure URI Path true/false
* @return self
*/
public function setSecure(bool $secure): self;
/**
* Set cookie http only flag. Cookie won't be accessible by scripting languages, such as JavaScript if true.
* Can effectively help to reduce identity theft through XSS attacks, Not supported in all browsers tho
* @param bool $httpOnly enable http only flag
* @return self
*/
public function sethttpOnly(bool $httpOnly): self;
/**
* Set same site
* @param string $samesite
* @return self
*/
public function setSameSite(string $samesite): self;
/**
* Set cookie
* @param string $name
* @param mixed $value
* @param int $expires
* @return void
*/
public function set(string $name, string $value, int $expires, bool $force = false): void;
/**
* Check is cookie exists
* @param string $name
* @return bool
*/
public function has(string $name): bool;
/**
* Get cookie
* @param string $name
* @param string|null $default
* @return string|null
*/
public function get(string $name, ?string $default = null): ?string;
/**
* Delete Cookie
* @param string $name
* @return void
*/
public function delete(string $name): void;
/**
* Check if cookies settings in this instance has great enough security to save e.g. CSRF token.
* Can not be read or set in: frontend, cross domain or in http (only https)
* @return bool
*/
public function isSecure(): bool;
}