Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class LegacyObjectNormalizerWrapper implements NormalizerInterface, SerializerAwareInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var NormalizerInterface |
||
16 | */ |
||
17 | private $normalizer; |
||
18 | |||
19 | 120 | public function __construct(AbstractNormalizer $normalizer) |
|
20 | { |
||
21 | 120 | $this->normalizer = $normalizer; |
|
22 | 120 | } |
|
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | 120 | public function normalize($object, $format = null, array $context = []) |
|
28 | { |
||
29 | 120 | $data = $this->normalizer->normalize($object, $format, $context); |
|
30 | |||
31 | return \array_filter($data, static function ($value) { |
||
32 | 106 | return null !== $value; |
|
33 | 120 | }); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 120 | public function supportsNormalization($data, $format = null) |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 120 | public function setSerializer(SerializerInterface $serializer) |
|
50 | 120 | } |
|
51 | } |
||
52 |