| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\Denormalizer; |
| 6 |
|
| 7 |
use function assert; |
| 8 |
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
| 9 |
use Webauthn\AuthenticationExtensions\AuthenticationExtension; |
| 10 |
|
| 11 |
final class AuthenticationExtensionNormalizer implements NormalizerInterface |
| 12 |
{ |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public function getSupportedTypes(?string $format): array |
| 17 |
{ |
| 18 |
return [ |
| 19 |
AuthenticationExtension::class => true, |
| 20 |
]; |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
public function normalize(mixed $object, ?string $format = null, array $context = []): array |
| 27 |
{ |
| 28 |
assert($object instanceof AuthenticationExtension); |
| 29 |
|
| 30 |
|
| 31 |
$value = $object->value; |
| 32 |
|
| 33 |
return $value; |
| 34 |
} |
| 35 |
|
| 36 |
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool |
| 37 |
{ |
| 38 |
return $data instanceof AuthenticationExtension; |
| 39 |
} |
| 40 |
} |