1 | <?php |
||
18 | class Signature |
||
19 | { |
||
20 | /** |
||
21 | * @var null|string |
||
22 | */ |
||
23 | private $encodedProtectedHeader; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $protectedHeader; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $header; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $signature; |
||
39 | |||
40 | public function __construct(string $signature, array $protectedHeader, ?string $encodedProtectedHeader, array $header) |
||
47 | |||
48 | /** |
||
49 | * The protected header associated with the signature. |
||
50 | */ |
||
51 | public function getProtectedHeader(): array |
||
55 | |||
56 | /** |
||
57 | * The unprotected header associated with the signature. |
||
58 | */ |
||
59 | public function getHeader(): array |
||
63 | |||
64 | /** |
||
65 | * The protected header associated with the signature. |
||
66 | */ |
||
67 | public function getEncodedProtectedHeader(): ?string |
||
71 | |||
72 | /** |
||
73 | * Returns the value of the protected header of the specified key. |
||
74 | * |
||
75 | * @param string $key The key |
||
76 | * |
||
77 | * @throws InvalidArgumentException if the header parameter does not exist |
||
78 | * |
||
79 | * @return null|mixed Header value |
||
80 | */ |
||
81 | public function getProtectedHeaderParameter(string $key) |
||
89 | |||
90 | /** |
||
91 | * Returns true if the protected header has the given parameter. |
||
92 | * |
||
93 | * @param string $key The key |
||
94 | */ |
||
95 | public function hasProtectedHeaderParameter(string $key): bool |
||
99 | |||
100 | /** |
||
101 | * Returns the value of the unprotected header of the specified key. |
||
102 | * |
||
103 | * @param string $key The key |
||
104 | * |
||
105 | * @return null|mixed Header value |
||
106 | */ |
||
107 | public function getHeaderParameter(string $key) |
||
115 | |||
116 | /** |
||
117 | * Returns true if the unprotected header has the given parameter. |
||
118 | * |
||
119 | * @param string $key The key |
||
120 | */ |
||
121 | public function hasHeaderParameter(string $key): bool |
||
125 | |||
126 | /** |
||
127 | * Returns the value of the signature. |
||
128 | */ |
||
129 | public function getSignature(): string |
||
133 | } |
||
134 |