Passed
Push — feature/support-certificate-an... ( 3825ca...55a1bf )
by Darío
02:40
created

SecurityContext::hasPrivateKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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