Certificate::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 2
nop 2
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the AppleApnPush package
7
 *
8
 * (c) Vitaliy Zhuk <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace Apple\ApnPush\Certificate;
15
16
use Apple\ApnPush\Exception\CertificateFileNotFoundException;
17
18
/**
19
 * Base certificate
20
 */
21
class Certificate implements CertificateInterface
22
{
23
    /**
24
     * @var string
25
     */
26
    private $path;
27
28
    /**
29
     * @var string
30
     */
31
    private $passPhrase;
32
33
    /**
34
     * Construct
35
     *
36
     * @param string $path
37
     * @param string $passPhrase
38
     *
39
     * @throws CertificateFileNotFoundException
40
     */
41 View Code Duplication
    public function __construct(string $path, string $passPhrase)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        if (!\file_exists($path) || !\is_file($path)) {
44
            throw new CertificateFileNotFoundException(\sprintf(
45
                'The certificate file "%s" was not found.',
46
                $path
47
            ));
48
        }
49
50
        $this->path = $path;
51
        $this->passPhrase = $passPhrase;
52
    }
53
54
    /**
55
     * Get path
56
     *
57
     * @return string
58
     */
59
    public function getPath(): string
60
    {
61
        return $this->path;
62
    }
63
64
    /**
65
     * Get pass phrase
66
     *
67
     * @return string
68
     */
69
    public function getPassPhrase(): string
70
    {
71
        return $this->passPhrase;
72
    }
73
}
74