Passed
Pull Request — master (#7)
by Pol
22:18 queued 20:04
created

KeyConverter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A fromJWKStoPEMS() 0 3 1
A fromJWKtoPEM() 0 3 1
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types=1);
9
10
namespace EcPhp\ApiGwAuthenticationBundle\Service\KeyConverter;
11
12
use CoderCat\JWKToPEM\JWKConverter;
13
14
final class KeyConverter implements KeyConverterInterface
15
{
16
    private JWKConverter $jwkConverter;
17
18 3
    public function __construct(JWKConverter $jwkConverter)
19
    {
20 3
        $this->jwkConverter = $jwkConverter;
21 3
    }
22
23 1
    public function fromJWKStoPEMS(array $jwks): array
24
    {
25 1
        return $this->jwkConverter->multipleToPEM($jwks);
26
    }
27
28 1
    public function fromJWKtoPEM(array $jwk): string
29
    {
30 1
        return $this->jwkConverter->toPEM($jwk);
31
    }
32
}
33