Passed
Push — master ( 90d55d...0e16d5 )
by Carlos C
03:42 queued 10s
created

PemContainer::hasAny()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 1
nc 3
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace CfdiUtils\OpenSSL;
3
4
class PemContainer
5
{
6
    /** @var string */
7
    private $certificate;
8
9
    /** @var string */
10
    private $publicKey;
11
12
    /** @var string */
13
    private $privateKey;
14
15 79
    public function __construct(string $certificate, string $publicKey, string $privateKey)
16
    {
17 79
        $this->certificate = $certificate;
18 79
        $this->publicKey = $publicKey;
19 79
        $this->privateKey = $privateKey;
20 79
    }
21
22 49
    public function certificate(): string
23
    {
24 49
        return $this->certificate;
25
    }
26
27 1
    public function publicKey(): string
28
    {
29 1
        return $this->publicKey;
30
    }
31
32 36
    public function privateKey(): string
33
    {
34 36
        return $this->privateKey;
35
    }
36
37 3
    public function hasAny(): bool
38
    {
39 3
        return $this->hasCertificate() || $this->hasPublicKey() || $this->hasPrivateKey();
40
    }
41
42 5
    public function hasCertificate(): bool
43
    {
44 5
        return ('' !== $this->certificate);
45
    }
46
47 5
    public function hasPublicKey(): bool
48
    {
49 5
        return ('' !== $this->publicKey);
50
    }
51
52 5
    public function hasPrivateKey(): bool
53
    {
54 5
        return ('' !== $this->privateKey);
55
    }
56
}
57