1 | <?php |
||
20 | final class JWS implements JWSInterface |
||
21 | { |
||
22 | use JWT; |
||
23 | |||
24 | /** |
||
25 | * @var \Jose\Object\SignatureInterface[] |
||
26 | */ |
||
27 | private $signatures = []; |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function getEncodedPayload() |
||
33 | { |
||
34 | $payload = $this->getPayload(); |
||
35 | if (null === $payload) { |
||
36 | return; |
||
37 | } elseif (is_string($payload)) { |
||
38 | return Base64Url::encode($payload); |
||
39 | } |
||
40 | $encoded = json_encode($payload); |
||
41 | Assertion::notNull($encoded, 'Unsupported payload.'); |
||
42 | |||
43 | return Base64Url::encode($encoded); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function getSignatures() |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function &getSignature($id) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function addSignature(JWKInterface $signature_key, array $protected_headers, array $headers = []) |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function addSignatureFromLoadedData($signature, $encoded_protected_headers, array $headers) |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function countSignatures() |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function toCompactJSON($id) |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | public function toFlattenedJSON($id) |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | public function toJSON() |
||
169 | } |
||
170 |