*/ public function getSupportedTypes(?string $format): array { return [ AllAcceptedCredentials::class => true, ]; } /** * @return array */ public function normalize(mixed $data, ?string $format = null, array $context = []): array { assert($data instanceof AllAcceptedCredentials); /** @var array $normalized_rp */ $normalized_rp = $this->normalizer->normalize($data->rp, $format, $context); /** @var array $normalized_user */ $normalized_user = $this->normalizer->normalize($data->user, $format, $context); /** @var array $normalized_credentials */ $normalized_credentials = array_map( fn (PublicKeyCredentialDescriptor $credential) => $this->normalizer->normalize( $credential, $format, $context ), $data->allAcceptedCredentials ); return [ 'rpId' => $normalized_rp['id'], 'userId' => $normalized_user['id'], 'allAcceptedCredentialIds' => array_map( static fn (array $credential): string => $credential['id'], $normalized_credentials ), ]; } public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof AllAcceptedCredentials; } }