1 | <?php |
||
16 | final class Normalizer implements NormalizerInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var NormalizerObjectMappingRegistryInterface |
||
20 | */ |
||
21 | private $normalizerObjectMappingRegistry; |
||
22 | |||
23 | /** |
||
24 | * @var LoggerInterface |
||
25 | */ |
||
26 | private $logger; |
||
27 | |||
28 | /** |
||
29 | * @var AuthorizationCheckerInterface |
||
30 | */ |
||
31 | private $authorizationChecker; |
||
32 | |||
33 | /** |
||
34 | * @param NormalizerObjectMappingRegistryInterface $normalizerObjectMappingRegistry |
||
35 | * @param LoggerInterface|null $logger |
||
36 | * @param AuthorizationCheckerInterface|null $authorizationChecker |
||
37 | */ |
||
38 | 5 | public function __construct( |
|
47 | |||
48 | /** |
||
49 | * @param object $object |
||
50 | * @param NormalizerContextInterface|null $context |
||
51 | * @param string $path |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | 5 | public function normalize( |
|
91 | |||
92 | /** |
||
93 | * @param object $object |
||
94 | * @param string $path |
||
95 | * |
||
96 | * @throws SerializerLogicException |
||
97 | */ |
||
98 | 5 | private function validateDataType($object, string $path) |
|
108 | |||
109 | /** |
||
110 | * @param string $class |
||
111 | * |
||
112 | * @return NormalizationObjectMappingInterface |
||
113 | * |
||
114 | * @throws SerializerLogicException |
||
115 | */ |
||
116 | 4 | private function getObjectMapping(string $class): NormalizationObjectMappingInterface |
|
126 | |||
127 | /** |
||
128 | * @param NormalizerContextInterface $context |
||
129 | * @param NormalizationFieldMappingInterface[] $normalizationFieldMappings |
||
130 | * @param string $path |
||
131 | * @param object $object |
||
132 | * |
||
133 | * @return array |
||
134 | */ |
||
135 | 3 | private function getFieldsByFieldNormalizationMappings( |
|
164 | |||
165 | /** |
||
166 | * @param NormalizerContextInterface $context |
||
167 | * @param NormalizationLinkMappingInterface[] $normalizationLinkMappings |
||
168 | * @param string $path |
||
169 | * @param object $object |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | 3 | private function getLinksByLinkNormalizationMappings( |
|
200 | |||
201 | /** |
||
202 | * @param NormalizerContextInterface $context |
||
203 | * @param NormalizationFieldMappingInterface|NormalizationLinkMappingInterface $mapping |
||
204 | * @param object $object |
||
205 | * |
||
206 | * @return bool |
||
207 | */ |
||
208 | 3 | private function isAllowed(NormalizerContextInterface $context, $mapping, $object) |
|
220 | |||
221 | /** |
||
222 | * @param NormalizerContextInterface $context |
||
223 | * @param NormalizationFieldMappingInterface|NormalizationLinkMappingInterface $mapping |
||
224 | * |
||
225 | * @return bool |
||
226 | */ |
||
227 | 3 | private function isWithinGroup(NormalizerContextInterface $context, $mapping): bool |
|
241 | |||
242 | /** |
||
243 | * @param string $path |
||
244 | * @param string $name |
||
245 | * |
||
246 | * @return string |
||
247 | */ |
||
248 | 3 | private function getSubPathByName(string $path, string $name): string |
|
252 | } |
||
253 |