Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class JwtKeySecret implements JwtKeyInterface |
||
6 | { |
||
7 | |||
8 | protected $key; |
||
9 | |||
10 | /** |
||
11 | * JwtKeySecret constructor. |
||
12 | * @param $key |
||
13 | * @param bool $decode |
||
14 | */ |
||
15 | 9 | public function __construct($key, $decode = true) |
|
16 | { |
||
17 | 9 | $this->key = ($decode ? base64_decode($key) : $key); |
|
18 | } |
||
19 | |||
20 | /** |
||
21 | * @param $key |
||
22 | * @param bool $decode |
||
23 | * @return JwtKeySecret |
||
24 | */ |
||
25 | 9 | public static function getInstance($key, $decode = true) |
|
26 | { |
||
27 | 9 | return new JwtKeySecret($key, $decode); |
|
28 | } |
||
29 | |||
30 | 8 | public function getPublicKey() |
|
31 | { |
||
32 | 8 | return $this->key; |
|
33 | } |
||
34 | |||
35 | 6 | public function getPrivateKey() |
|
36 | { |
||
37 | 6 | return $this->key; |
|
38 | } |
||
39 | |||
40 | 8 | public function getAlghoritm() |
|
43 | } |
||
44 | } |
||
45 |