Passed
Push — master ( 4ea08d...5059e4 )
by Darío
51s queued 12s
created

SecurityContext   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 37
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setPrivateKey() 0 5 1
A getCertificate() 0 3 1
A getPrivateKey() 0 3 1
A hasPrivateKey() 0 3 1
A setCertificate() 0 5 1
A hasCertificate() 0 3 1
1
<?php
2
3
namespace EasyHttp\LayerContracts\Common;
4
5
use EasyHttp\LayerContracts\Contracts\Request\HttpSecurityContext;
6
7
class SecurityContext implements HttpSecurityContext
8
{
9
    protected string $certificate;
10
    protected string $privateKey;
11
12 1
    public function getCertificate(): string
13
    {
14 1
        return $this->certificate;
15
    }
16
17 1
    public function getPrivateKey(): string
18
    {
19 1
        return $this->privateKey;
20
    }
21
22 1
    public function hasCertificate(): bool
23
    {
24 1
        return $this->certificate ?? false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->certificate ?? false could return the type string which is incompatible with the type-hinted return boolean. Consider adding an additional type-check to rule them out.
Loading history...
25
    }
26
27 1
    public function hasPrivateKey(): bool
28
    {
29 1
        return $this->privateKey ?? false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->privateKey ?? false could return the type string which is incompatible with the type-hinted return boolean. Consider adding an additional type-check to rule them out.
Loading history...
30
    }
31
32 1
    public function setCertificate(string $certificate): self
33
    {
34 1
        $this->certificate = $certificate;
35
36 1
        return $this;
37
    }
38
39 1
    public function setPrivateKey(string $privateKey): self
40
    {
41 1
        $this->privateKey = $privateKey;
42
43 1
        return $this;
44
    }
45
}
46