Completed
Push — master ( 1ba115...baab82 )
by Nico
02:35
created

SetCookieHeaderResult   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 60
ccs 20
cts 22
cp 0.9091
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A isSecure() 0 4 2
A hasFlagSecure() 0 4 1
A setHasFlagSecure() 0 6 1
A hasFlagHttpOnly() 0 4 1
A setHasFlagHttpOnly() 0 6 1
A hasFlagSameSite() 0 4 1
A setHasFlagSameSite() 0 6 1
A setCookieName() 0 6 1
A cookieName() 0 4 1
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