1 | <?php |
||
26 | class AuthorizationCode extends Token |
||
27 | { |
||
28 | /** |
||
29 | * @var AuthorizationCodeId |
||
30 | */ |
||
31 | private $authorizationCodeId = null; |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | private $queryParameters = []; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $redirectUri = null; |
||
42 | |||
43 | /** |
||
44 | * @var bool |
||
45 | */ |
||
46 | private $used = false; |
||
47 | |||
48 | /** |
||
49 | * @return AuthorizationCode |
||
50 | */ |
||
51 | public static function createEmpty(): self |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public static function getSchema(): string |
||
63 | |||
64 | /** |
||
65 | * @param AuthorizationCodeId $authorizationCodeId |
||
66 | * @param ClientId $clientId |
||
67 | * @param UserAccountId $userAccountId |
||
68 | * @param array $queryParameters |
||
69 | * @param string $redirectUri |
||
70 | * @param \DateTimeImmutable $expiresAt |
||
71 | * @param DataBag $parameters |
||
72 | * @param DataBag $metadatas |
||
73 | * @param ResourceServerId $resourceServerId |
||
74 | * |
||
75 | * @return AuthorizationCode |
||
76 | */ |
||
77 | public function create(AuthorizationCodeId $authorizationCodeId, ClientId $clientId, UserAccountId $userAccountId, array $queryParameters, string $redirectUri, \DateTimeImmutable $expiresAt, DataBag $parameters, DataBag $metadatas, ? ResourceServerId $resourceServerId) |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function getTokenId(): TokenId |
||
109 | |||
110 | /** |
||
111 | * @return array |
||
112 | */ |
||
113 | public function getQueryParameters(): array |
||
117 | |||
118 | /** |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function isUsed(): bool |
||
125 | |||
126 | /** |
||
127 | * @return AuthorizationCode |
||
128 | */ |
||
129 | public function markAsUsed(): self |
||
141 | |||
142 | /** |
||
143 | * @return AuthorizationCode |
||
144 | */ |
||
145 | public function markAsRevoked(): self |
||
154 | |||
155 | /** |
||
156 | * @return array |
||
157 | */ |
||
158 | public function getQueryParams(): array |
||
162 | |||
163 | /** |
||
164 | * @param string $key |
||
165 | * |
||
166 | * @return mixed |
||
167 | */ |
||
168 | public function getQueryParam(string $key) |
||
176 | |||
177 | /** |
||
178 | * @param string $key |
||
179 | * |
||
180 | * @return bool |
||
181 | */ |
||
182 | public function hasQueryParams(string $key): bool |
||
186 | |||
187 | /** |
||
188 | * @return string |
||
189 | */ |
||
190 | public function getRedirectUri(): string |
||
198 | |||
199 | /** |
||
200 | * @return array |
||
201 | */ |
||
202 | public function toArray(): array |
||
208 | |||
209 | /** |
||
210 | * {@inheritdoc} |
||
211 | */ |
||
212 | public static function createFromJson(\stdClass $json): DomainObject |
||
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | */ |
||
248 | public function jsonSerialize() |
||
259 | |||
260 | /** |
||
261 | * @param Event $event |
||
262 | * |
||
263 | * @return AuthorizationCode |
||
264 | */ |
||
265 | public function apply(Event $event): self |
||
278 | |||
279 | /** |
||
280 | * @return array |
||
281 | */ |
||
282 | private function getEventMap(): array |
||
290 | |||
291 | /** |
||
292 | * @param AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event |
||
293 | * |
||
294 | * @return AuthorizationCode |
||
295 | */ |
||
296 | protected function applyAuthorizationCodeCreatedEvent(AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event): self |
||
312 | |||
313 | /** |
||
314 | * @param AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event |
||
315 | * |
||
316 | * @return AuthorizationCode |
||
317 | */ |
||
318 | protected function applyAuthorizationCodeMarkedAsUsedEvent(AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event): self |
||
325 | |||
326 | /** |
||
327 | * @param AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event |
||
328 | * |
||
329 | * @return AuthorizationCode |
||
330 | */ |
||
331 | protected function applyAuthorizationCodeRevokedEvent(AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event): self |
||
338 | } |
||
339 |