1 | <?php |
||
19 | final class JWK implements JWKInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $values = []; |
||
25 | |||
26 | /** |
||
27 | * JWK constructor. |
||
28 | * |
||
29 | * @param array $values |
||
30 | */ |
||
31 | public function __construct(array $values = []) |
||
32 | { |
||
33 | if (!array_key_exists('kty', $values)) { |
||
34 | throw new \InvalidArgumentException('The parameter "kty" is mandatory.'); |
||
35 | } |
||
36 | $this->values = $values; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function jsonSerialize() |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function get($key) |
||
51 | { |
||
52 | if ($this->has($key)) { |
||
53 | return $this->values[$key]; |
||
54 | } |
||
55 | throw new \InvalidArgumentException(sprintf('The value identified by "%s" does not exist.', $key)); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function has($key) |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function getAll() |
||
73 | |||
74 | public function thumbprint($hash_algorithm) |
||
86 | |||
87 | /** |
||
88 | * @return \Jose\Object\JWKInterface |
||
89 | */ |
||
90 | public function toPublic() |
||
97 | } |
||
98 |