| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 9 | class CategoriesNormalizer implements NormalizerInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var CategoryNormalizer |
||
| 13 | */ |
||
| 14 | private $categoryNormalizer; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param CategoryNormalizer $categoryNormalizer |
||
| 18 | */ |
||
| 19 | public function __construct(CategoryNormalizer $categoryNormalizer) |
||
| 20 | { |
||
| 21 | $this->categoryNormalizer = $categoryNormalizer; |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @inheritdoc |
||
| 26 | */ |
||
| 27 | public function normalize($categories, $format = null, array $context = []): array |
||
| 28 | { |
||
| 29 | /** @var Categories $categories */ |
||
| 30 | return array_map( |
||
| 31 | function (Category $category) use ($format, $context) { |
||
| 32 | return $this->categoryNormalizer->normalize($category, $format, $context); |
||
| 33 | }, |
||
| 34 | $categories->toArray() |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @inheritdoc |
||
| 40 | */ |
||
| 41 | public function supportsNormalization($data, $format = null): bool |
||
| 44 | } |
||
| 45 | } |
||
| 46 |