Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.0123 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | 1 | protected function getIssuerJWKFromKid(IssuerInterface $issuer, string $kid): JWK |
|
38 | { |
||
39 | 1 | $jwks = $issuer->getJwks(); |
|
40 | |||
41 | 1 | $jwk = $jwks->selectKey('sig', null, ['kid' => $kid]); |
|
42 | |||
43 | 1 | if (null === $jwk) { |
|
44 | 1 | $issuer->updateJwks(); |
|
45 | 1 | $jwk = $issuer->getJwks()->selectKey('sig', null, ['kid' => $kid]); |
|
46 | } |
||
47 | |||
48 | 1 | if (null === $jwk) { |
|
49 | throw new RuntimeException('Unable to find the jwk with the provided kid: ' . $kid); |
||
50 | } |
||
51 | |||
52 | 1 | return $jwk; |
|
53 | } |
||
55 |