1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license http://opensource.org/licenses/mit-license.php MIT |
5
|
|
|
* @link https://github.com/nicoSWD |
6
|
|
|
* @author Nicolas Oelgart <[email protected]> |
7
|
|
|
*/ |
8
|
|
|
namespace nicoSWD\SecHeaderCheck\Domain\Result\Result; |
9
|
|
|
|
10
|
|
|
use nicoSWD\SecHeaderCheck\Domain\Result\AbstractParsedHeader; |
11
|
|
|
|
12
|
|
|
final class SetCookieHeaderResult extends AbstractParsedHeader |
13
|
|
|
{ |
14
|
|
|
private $hasFlagSecure = false; |
15
|
|
|
private $hasFlagHttpOnly = false; |
16
|
|
|
private $hasFlagSameSite = false; |
17
|
|
|
private $cookieName = ''; |
18
|
|
|
|
19
|
|
|
public function isSecure(): bool |
20
|
|
|
{ |
21
|
|
|
return $this->hasFlagHttpOnly() && $this->hasFlagSecure(); |
22
|
|
|
} |
23
|
|
|
|
24
|
8 |
|
public function hasFlagSecure(): bool |
25
|
|
|
{ |
26
|
8 |
|
return $this->hasFlagSecure; |
27
|
|
|
} |
28
|
|
|
|
29
|
8 |
|
public function setHasFlagSecure(bool $hasFlagSecure): self |
30
|
|
|
{ |
31
|
8 |
|
$this->hasFlagSecure = $hasFlagSecure; |
32
|
|
|
|
33
|
8 |
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
8 |
|
public function hasFlagHttpOnly(): bool |
37
|
|
|
{ |
38
|
8 |
|
return $this->hasFlagHttpOnly; |
39
|
|
|
} |
40
|
|
|
|
41
|
8 |
|
public function setHasFlagHttpOnly(bool $hasFlagHttpOnly): self |
42
|
|
|
{ |
43
|
8 |
|
$this->hasFlagHttpOnly = $hasFlagHttpOnly; |
44
|
|
|
|
45
|
8 |
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
8 |
|
public function hasFlagSameSite(): bool |
49
|
|
|
{ |
50
|
8 |
|
return $this->hasFlagSameSite; |
51
|
|
|
} |
52
|
|
|
|
53
|
8 |
|
public function setHasFlagSameSite(bool $hasFlagSameSite): self |
54
|
|
|
{ |
55
|
8 |
|
$this->hasFlagSameSite = $hasFlagSameSite; |
56
|
|
|
|
57
|
8 |
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
8 |
|
public function setCookieName(string $cookieName): self |
61
|
|
|
{ |
62
|
8 |
|
$this->cookieName = $cookieName; |
63
|
|
|
|
64
|
8 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
8 |
|
public function cookieName(): string |
68
|
|
|
{ |
69
|
8 |
|
return $this->cookieName; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|