| Total Complexity | 5 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | class RelationCollectionNormalizer implements NormalizerInterface, NormalizerAwareInterface |
||
| 28 | { |
||
| 29 | use NormalizerAwareTrait; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritdoc} |
||
| 33 | * |
||
| 34 | * @param RelationCollection $object |
||
| 35 | * |
||
| 36 | * @throws \InvalidArgumentException |
||
| 37 | */ |
||
| 38 | public function normalize($object, $format = null, array $context = []): array |
||
| 39 | { |
||
| 40 | $data = []; |
||
| 41 | |||
| 42 | foreach ($object as $relation) { |
||
| 43 | $data[$relation->getName()] = $this->normalizer->normalize($relation, $format); |
||
| 44 | } |
||
| 45 | |||
| 46 | return $data; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | public function supportsNormalization($data, $format = null): bool |
||
| 55 | } |
||
| 56 | } |
||
| 57 |