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\Budgets\Normalizer;
12:
13: use NxSys\Library\Clients\Brex\API\Budgets\Runtime\Normalizer\CheckArray;
14: use NxSys\Library\Clients\Brex\API\Budgets\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\\Budgets\\Model\\Budget' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\BudgetNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\BudgetLimit' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\BudgetLimitNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\BudgetCurrentPeriodBalance' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\BudgetCurrentPeriodBalanceNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\BudgetPeriodBalance' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\BudgetPeriodBalanceNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\BudgetPeriodBalanceBalance' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\BudgetPeriodBalanceBalanceNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\CreateBudgetRequest' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\CreateBudgetRequestNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\Money' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\MoneyNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\PageBudget' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\PageBudgetNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\UpdateBudgetRequest' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\UpdateBudgetRequestNormalizer', 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Model\\UpdateBudgetRequestLimit' => 'NxSys\\Library\\Clients\\Brex\\API\\Budgets\\Normalizer\\UpdateBudgetRequestLimitNormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\NxSys\\Library\\Clients\\Brex\\API\\Budgets\\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: