1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | namespace NxSys\Library\Clients\Brex\API\Payments\Runtime\Normalizer; |
12: | |
13: | use Jane\Component\JsonSchemaRuntime\Reference; |
14: | use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
15: | |
16: | class ReferenceNormalizer implements NormalizerInterface |
17: | { |
18: | |
19: | |
20: | |
21: | public function normalize($object, $format = null, array $context = []) |
22: | { |
23: | $ref = []; |
24: | $ref['$ref'] = (string) $object->getReferenceUri(); |
25: | |
26: | return $ref; |
27: | } |
28: | |
29: | |
30: | |
31: | |
32: | public function supportsNormalization($data, $format = null): bool |
33: | { |
34: | return $data instanceof Reference; |
35: | } |
36: | } |
37: | |