|
16 | 16 | use Jane\Component\JsonSchemaRuntime\Reference; |
17 | 17 | use JoliCode\Slack\Api\Runtime\Normalizer\CheckArray; |
18 | 18 | use JoliCode\Slack\Api\Runtime\Normalizer\ValidatorTrait; |
| 19 | +use Symfony\Component\HttpKernel\Kernel; |
19 | 20 | use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; |
20 | 21 | use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; |
21 | 22 | use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; |
22 | 23 | use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; |
23 | 24 | use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; |
24 | 25 | use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
25 | 26 |
|
26 | | -class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface |
27 | | -{ |
28 | | - use CheckArray; |
29 | | - use DenormalizerAwareTrait; |
30 | | - use NormalizerAwareTrait; |
31 | | - use ValidatorTrait; |
32 | | - |
33 | | - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool |
| 27 | +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { |
| 28 | + class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface |
34 | 29 | { |
35 | | - return 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === $type; |
36 | | - } |
37 | | - |
38 | | - public function supportsNormalization($data, $format = null, array $context = []): bool |
39 | | - { |
40 | | - return \is_object($data) && 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === \get_class($data); |
41 | | - } |
| 30 | + use CheckArray; |
| 31 | + use DenormalizerAwareTrait; |
| 32 | + use NormalizerAwareTrait; |
| 33 | + use ValidatorTrait; |
42 | 34 |
|
43 | | - public function denormalize($data, $class, $format = null, array $context = []) |
44 | | - { |
45 | | - if (isset($data['$ref'])) { |
46 | | - return new Reference($data['$ref'], $context['document-origin']); |
| 35 | + public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool |
| 36 | + { |
| 37 | + return 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === $type; |
47 | 38 | } |
48 | | - if (isset($data['$recursiveRef'])) { |
49 | | - return new Reference($data['$recursiveRef'], $context['document-origin']); |
| 39 | + |
| 40 | + public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool |
| 41 | + { |
| 42 | + return \is_object($data) && 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === \get_class($data); |
50 | 43 | } |
51 | | - $object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200(); |
52 | | - if (null === $data || false === \is_array($data)) { |
| 44 | + |
| 45 | + public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed |
| 46 | + { |
| 47 | + if (isset($data['$ref'])) { |
| 48 | + return new Reference($data['$ref'], $context['document-origin']); |
| 49 | + } |
| 50 | + if (isset($data['$recursiveRef'])) { |
| 51 | + return new Reference($data['$recursiveRef'], $context['document-origin']); |
| 52 | + } |
| 53 | + $object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200(); |
| 54 | + if (null === $data || false === \is_array($data)) { |
| 55 | + return $object; |
| 56 | + } |
| 57 | + if (\array_key_exists('ok', $data) && null !== $data['ok']) { |
| 58 | + $object->setOk($data['ok']); |
| 59 | + unset($data['ok']); |
| 60 | + } elseif (\array_key_exists('ok', $data) && null === $data['ok']) { |
| 61 | + $object->setOk(null); |
| 62 | + } |
| 63 | + foreach ($data as $key => $value) { |
| 64 | + if (preg_match('/.*/', (string) $key)) { |
| 65 | + $object[$key] = $value; |
| 66 | + } |
| 67 | + } |
| 68 | + |
53 | 69 | return $object; |
54 | 70 | } |
55 | | - if (\array_key_exists('ok', $data) && null !== $data['ok']) { |
56 | | - $object->setOk($data['ok']); |
57 | | - unset($data['ok']); |
58 | | - } elseif (\array_key_exists('ok', $data) && null === $data['ok']) { |
59 | | - $object->setOk(null); |
60 | | - } |
61 | | - foreach ($data as $key => $value) { |
62 | | - if (preg_match('/.*/', (string) $key)) { |
63 | | - $object[$key] = $value; |
| 71 | + |
| 72 | + public function normalize(mixed $object, string $format = null, array $context = []): null|array|\ArrayObject|bool|float|int|string |
| 73 | + { |
| 74 | + $data = []; |
| 75 | + $data['ok'] = $object->getOk(); |
| 76 | + foreach ($object as $key => $value) { |
| 77 | + if (preg_match('/.*/', (string) $key)) { |
| 78 | + $data[$key] = $value; |
| 79 | + } |
64 | 80 | } |
| 81 | + |
| 82 | + return $data; |
65 | 83 | } |
66 | 84 |
|
67 | | - return $object; |
| 85 | + public function getSupportedTypes(string $format = null): array |
| 86 | + { |
| 87 | + return ['JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' => false]; |
| 88 | + } |
68 | 89 | } |
69 | | - |
70 | | - /** |
71 | | - * @return array|string|int|float|bool|\ArrayObject|null |
72 | | - */ |
73 | | - public function normalize($object, $format = null, array $context = []) |
| 90 | +} else { |
| 91 | + class AdminAppsApprovePostResponse200Normalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface |
74 | 92 | { |
75 | | - $data = []; |
76 | | - $data['ok'] = $object->getOk(); |
77 | | - foreach ($object as $key => $value) { |
78 | | - if (preg_match('/.*/', (string) $key)) { |
79 | | - $data[$key] = $value; |
| 93 | + use CheckArray; |
| 94 | + use DenormalizerAwareTrait; |
| 95 | + use NormalizerAwareTrait; |
| 96 | + use ValidatorTrait; |
| 97 | + |
| 98 | + public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool |
| 99 | + { |
| 100 | + return 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === $type; |
| 101 | + } |
| 102 | + |
| 103 | + public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool |
| 104 | + { |
| 105 | + return \is_object($data) && 'JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' === \get_class($data); |
| 106 | + } |
| 107 | + |
| 108 | + public function denormalize($data, $type, $format = null, array $context = []) |
| 109 | + { |
| 110 | + if (isset($data['$ref'])) { |
| 111 | + return new Reference($data['$ref'], $context['document-origin']); |
| 112 | + } |
| 113 | + if (isset($data['$recursiveRef'])) { |
| 114 | + return new Reference($data['$recursiveRef'], $context['document-origin']); |
| 115 | + } |
| 116 | + $object = new \JoliCode\Slack\Api\Model\AdminAppsApprovePostResponse200(); |
| 117 | + if (null === $data || false === \is_array($data)) { |
| 118 | + return $object; |
| 119 | + } |
| 120 | + if (\array_key_exists('ok', $data) && null !== $data['ok']) { |
| 121 | + $object->setOk($data['ok']); |
| 122 | + unset($data['ok']); |
| 123 | + } elseif (\array_key_exists('ok', $data) && null === $data['ok']) { |
| 124 | + $object->setOk(null); |
80 | 125 | } |
| 126 | + foreach ($data as $key => $value) { |
| 127 | + if (preg_match('/.*/', (string) $key)) { |
| 128 | + $object[$key] = $value; |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + return $object; |
81 | 133 | } |
82 | 134 |
|
83 | | - return $data; |
84 | | - } |
| 135 | + /** |
| 136 | + * @return array|string|int|float|bool|\ArrayObject|null |
| 137 | + */ |
| 138 | + public function normalize($object, $format = null, array $context = []) |
| 139 | + { |
| 140 | + $data = []; |
| 141 | + $data['ok'] = $object->getOk(); |
| 142 | + foreach ($object as $key => $value) { |
| 143 | + if (preg_match('/.*/', (string) $key)) { |
| 144 | + $data[$key] = $value; |
| 145 | + } |
| 146 | + } |
85 | 147 |
|
86 | | - public function getSupportedTypes(string $format = null): array |
87 | | - { |
88 | | - return ['JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' => false]; |
| 148 | + return $data; |
| 149 | + } |
| 150 | + |
| 151 | + public function getSupportedTypes(string $format = null): array |
| 152 | + { |
| 153 | + return ['JoliCode\\Slack\\Api\\Model\\AdminAppsApprovePostResponse200' => false]; |
| 154 | + } |
89 | 155 | } |
90 | 156 | } |
0 commit comments