1 | <?php |
||
15 | final class Normalizer implements NormalizerInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var NormalizerObjectMappingRegistryInterface |
||
19 | */ |
||
20 | private $normalizerObjectMappingRegistry; |
||
21 | |||
22 | /** |
||
23 | * @var LoggerInterface |
||
24 | */ |
||
25 | private $logger; |
||
26 | |||
27 | /** |
||
28 | * @param NormalizerObjectMappingRegistryInterface $normalizerObjectMappingRegistry |
||
29 | * @param LoggerInterface|null $logger |
||
30 | */ |
||
31 | 6 | public function __construct( |
|
38 | |||
39 | /** |
||
40 | * @param object $object |
||
41 | * @param NormalizerContextInterface|null $context |
||
42 | * @param string $path |
||
43 | * |
||
44 | * @return array |
||
45 | */ |
||
46 | 6 | public function normalize( |
|
82 | |||
83 | /** |
||
84 | * @param object $object |
||
85 | * @param string $path |
||
86 | * |
||
87 | * @throws SerializerLogicException |
||
88 | */ |
||
89 | 6 | private function validateDataType($object, string $path) |
|
99 | |||
100 | /** |
||
101 | * @param string $class |
||
102 | * |
||
103 | * @return NormalizationObjectMappingInterface |
||
104 | * |
||
105 | * @throws SerializerLogicException |
||
106 | */ |
||
107 | 5 | private function getObjectMapping(string $class): NormalizationObjectMappingInterface |
|
117 | |||
118 | /** |
||
119 | * @param NormalizerContextInterface $context |
||
120 | * @param NormalizationFieldMappingInterface[] $normalizationFieldMappings |
||
121 | * @param string $path |
||
122 | * @param object $object |
||
123 | * |
||
124 | * @return array |
||
125 | */ |
||
126 | 4 | private function getFieldsByFieldNormalizationMappings( |
|
155 | |||
156 | /** |
||
157 | * @param NormalizerContextInterface $context |
||
158 | * @param NormalizationLinkMappingInterface[] $normalizationLinkMappings |
||
159 | * @param string $path |
||
160 | * @param object $object |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | 4 | private function getLinksByLinkNormalizationMappings( |
|
191 | |||
192 | /** |
||
193 | * @param NormalizerContextInterface $context |
||
194 | * @param NormalizationFieldMappingInterface|NormalizationLinkMappingInterface $mapping |
||
195 | * @param object $object |
||
196 | * |
||
197 | * @return bool |
||
198 | */ |
||
199 | 4 | private function isCompliant(NormalizerContextInterface $context, $mapping, $object): bool |
|
207 | |||
208 | /** |
||
209 | * @param NormalizerContextInterface $context |
||
210 | * @param NormalizationFieldMappingInterface|NormalizationLinkMappingInterface $mapping |
||
211 | * |
||
212 | * @return bool |
||
213 | */ |
||
214 | 4 | private function isWithinGroup(NormalizerContextInterface $context, $mapping): bool |
|
237 | |||
238 | /** |
||
239 | * @param string $path |
||
240 | * @param string $name |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | 2 | private function getSubPathByName(string $path, string $name): string |
|
248 | } |
||
249 |
If you suppress an error, we recommend checking for the error condition explicitly: