Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 88.89% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
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 | }); |
||
26 | } |
||
27 | |||
28 | 3 | public function issuer(): Issuer |
|
31 | } |
||
32 | } |
||
33 |