Total Complexity | 9 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | final class Key |
||
21 | { |
||
22 | /** |
||
23 | * @var KeyType |
||
24 | */ |
||
25 | private $type; |
||
26 | |||
27 | /** |
||
28 | * @var RSAKeyLength |
||
29 | */ |
||
30 | private $length; |
||
31 | |||
32 | /** |
||
33 | * @var ECKeyAlgorithm |
||
34 | */ |
||
35 | private $algorithm; |
||
36 | |||
37 | private function __construct(KeyType $type) |
||
40 | } |
||
41 | |||
42 | public static function rsa(RSAKeyLength $length): self |
||
43 | { |
||
44 | $key = new static(KeyType::rsa()); |
||
45 | |||
46 | return $key->setLength($length); |
||
47 | } |
||
48 | |||
49 | public static function ec(ECKeyAlgorithm $algorithm): self |
||
54 | } |
||
55 | |||
56 | public function generate(KeyGenerator $keyGenerator, string $privateKeyPath, string $publicKeyPath): void |
||
69 | ); |
||
70 | } |
||
71 | } |
||
72 | |||
73 | public function getType(): KeyType |
||
74 | { |
||
75 | return $this->type; |
||
76 | } |
||
77 | |||
78 | private function setLength(RSAKeyLength $length): self |
||
79 | { |
||
80 | $this->length = $length; |
||
81 | |||
82 | return $this; |
||
83 | } |
||
84 | |||
85 | private function setAlgorithm(ECKeyAlgorithm $algorithm): self |
||
90 | } |
||
91 | } |
||
92 |