1: <?php
2:
3: declare(strict_types=1);
4:
5: /*
6: * This file has been auto generated by Jane,
7: *
8: * Do no edit it directly.
9: */
10:
11: namespace NxSys\Library\Clients\Brex\API\Expenses\Normalizer;
12:
13: use NxSys\Library\Clients\Brex\API\Expenses\Runtime\Normalizer\CheckArray;
14: use NxSys\Library\Clients\Brex\API\Expenses\Runtime\Normalizer\ValidatorTrait;
15: use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
16: use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
17: use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
18: use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
19: use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
20: use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
21:
22: class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
23: {
24: use DenormalizerAwareTrait;
25: use NormalizerAwareTrait;
26: use CheckArray;
27: use ValidatorTrait;
28: protected $normalizers = ['NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\CreateAsyncFileUploadResponse' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\CreateAsyncFileUploadResponseNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\Department' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\DepartmentNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\ExpandableExpense' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ExpandableExpenseNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\ExpandableExpenseLocation' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ExpandableExpenseLocationNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\ExpandableExpenseDepartment' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ExpandableExpenseDepartmentNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\Expense' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ExpenseNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\Location' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\LocationNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\PageExpandableExpense' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\PageExpandableExpenseNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\Receipt' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ReceiptNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\ReceiptMatchRequest' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ReceiptMatchRequestNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\ReceiptUploadRequest' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\ReceiptUploadRequestNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Model\\UpdateExpenseRequest' => 'NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Normalizer\\UpdateExpenseRequestNormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\NxSys\\Library\\Clients\\Brex\\API\\Expenses\\Runtime\\Normalizer\\ReferenceNormalizer'];
29: protected $normalizersCache = [];
30:
31: public function supportsDenormalization($data, $type, $format = null): bool
32: {
33: return array_key_exists($type, $this->normalizers);
34: }
35:
36: public function supportsNormalization($data, $format = null): bool
37: {
38: return is_object($data) && array_key_exists(get_class($data), $this->normalizers);
39: }
40:
41: /**
42: * @return array|string|int|float|bool|\ArrayObject|null
43: */
44: public function normalize($object, $format = null, array $context = [])
45: {
46: $normalizerClass = $this->normalizers[get_class($object)];
47: $normalizer = $this->getNormalizer($normalizerClass);
48:
49: return $normalizer->normalize($object, $format, $context);
50: }
51:
52: /**
53: * @return mixed
54: */
55: public function denormalize($data, $class, $format = null, array $context = [])
56: {
57: $denormalizerClass = $this->normalizers[$class];
58: $denormalizer = $this->getNormalizer($denormalizerClass);
59:
60: return $denormalizer->denormalize($data, $class, $format, $context);
61: }
62:
63: private function getNormalizer(string $normalizerClass)
64: {
65: return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass);
66: }
67:
68: private function initNormalizer(string $normalizerClass)
69: {
70: $normalizer = new $normalizerClass();
71: $normalizer->setNormalizer($this->normalizer);
72: $normalizer->setDenormalizer($this->denormalizer);
73: $this->normalizersCache[$normalizerClass] = $normalizer;
74:
75: return $normalizer;
76: }
77: }
78: