KeyResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
ccs 9
cts 10
cp 0.9
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A issuer() 0 3 1
A __construct() 0 4 1
A jwkset() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace CustomerGauge\Cognito;
4
5
use Illuminate\Contracts\Cache\Repository;
6
7
final class KeyResolver
8
{
9
    private $cache;
10
11
    private $issuer;
12
13 4
    public function __construct(Issuer $issuer, Repository $cache)
14
    {
15 4
        $this->issuer = $issuer;
16 4
        $this->cache = $cache;
17
    }
18
19 4
    public function jwkset(): string
20
    {
21 4
        $url = $this->issuer->toString() . '/.well-known/jwks.json';
22
23 4
        return $this->cache->remember('jwks', 7200, function() use ($url) {
24
            return file_get_contents($url);
25 4
        });
26
    }
27
28 3
    public function issuer(): Issuer
29
    {
30 3
        return $this->issuer;
31
    }
32
}
33