Total Complexity | 5 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
16 | class CollectionNormalizer implements DenormalizerInterface, DenormalizerAwareInterface |
||
17 | { |
||
18 | use DenormalizerAwareTrait; |
||
19 | |||
20 | 7 | public function supportsDenormalization($data, $type, $format = null): bool |
|
21 | { |
||
22 | 7 | $supports = false; |
|
23 | |||
24 | 7 | if (class_exists($type)) { |
|
25 | 6 | $reflectionClass = new \ReflectionClass($type); |
|
26 | 6 | $inheritsClass = $reflectionClass->isSubclassOf(CollectionInterface::class); |
|
27 | 6 | $supports = is_array($data) && $inheritsClass; |
|
28 | } |
||
29 | |||
30 | 7 | return $supports; |
|
31 | } |
||
32 | |||
33 | 2 | public function denormalize($data, $class, $format = null, array $context = []): CollectionInterface |
|
46 | } |
||
47 | } |
||
48 |