Keypair::privateKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
3
namespace Link0\Bunq\Domain;
4
5
use Link0\Bunq\Domain\Keypair\PrivateKey;
6
use Link0\Bunq\Domain\Keypair\PublicKey;
7
8
final class Keypair
9
{
10
    /**
11
     * @var PublicKey
12
     */
13
    private $publicKey;
14
    /**
15
     * @var PrivateKey
16
     */
17
    private $privateKey;
18
19
    /**
20
     * @param PublicKey $publicKey
21
     * @param PrivateKey $privateKey
22
     */
23
    public function __construct(PublicKey $publicKey, PrivateKey $privateKey)
24
    {
25
        $this->publicKey = $publicKey;
26
        $this->privateKey = $privateKey;
27
    }
28
29
    /**
30
     * @return PrivateKey
31
     */
32
    public function privateKey(): PrivateKey
33
    {
34
        return $this->privateKey;
35
    }
36
37
    /**
38
     * @return PublicKey
39
     */
40
    public function publicKey(): PublicKey
41
    {
42
        return $this->publicKey;
43
    }
44
45
    /**
46
     * @param string $publicKey
47
     * @param string $privateKey
48
     * @return Keypair
49
     */
50
    public static function fromStrings(string $publicKey, string $privateKey)
51
    {
52
        return new self(
53
            new PublicKey($publicKey),
54
            new PrivateKey($privateKey)
55
        );
56
    }
57
}
58