Completed
Branch zenstruck-fork (6c313f)
by Kevin
03:51
created

Keychain::publicKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Zenstruck\JWT\Signer\OpenSSL;
4
5
/**
6
 * @author Kevin Bond <[email protected]>
7
 */
8
final class Keychain
9
{
10
    private $publicKey;
11
    private $privateKey;
12
13
    /**
14
     * @param PublicKey|mixed  $publicKey
15
     * @param PrivateKey|mixed $privateKey
16
     * @param string|null      $passphrase
17
     */
18 9
    public function __construct($publicKey, $privateKey, $passphrase = null)
19
    {
20 9
        $this->publicKey = $publicKey instanceof PublicKey ? $publicKey : new PublicKey($publicKey);
21 9
        $this->privateKey = $privateKey instanceof PrivateKey ? $privateKey : new PrivateKey($privateKey, $passphrase);
22 9
    }
23
24
    /**
25
     * @return PublicKey
26
     */
27 3
    public function publicKey()
28
    {
29 3
        return $this->publicKey;
30
    }
31
32
    /**
33
     * @return PrivateKey
34
     */
35 6
    public function privateKey()
36
    {
37 6
        return $this->privateKey;
38
    }
39
}
40