Keychain   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 32
wmc 5
lcom 0
cbo 2
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 3
A publicKey() 0 4 1
A privateKey() 0 4 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