Total Complexity | 4 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | class ValueObjectNormalizer implements NormalizerInterface, DenormalizerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @param mixed $data |
||
15 | * @param string $class |
||
16 | * @param string|null $format |
||
17 | * @param array $context |
||
18 | * @return ValueObjectInterface |
||
19 | */ |
||
20 | public function denormalize($data, $class, $format = null, array $context = []) |
||
21 | { |
||
22 | return $class::fromNative($data); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * @param mixed $data |
||
27 | * @param string $type |
||
28 | * @param string|null $format |
||
29 | * @return bool |
||
30 | */ |
||
31 | public function supportsDenormalization($data, $type, $format = null) |
||
32 | { |
||
33 | return is_a($type, ValueObjectInterface::class, true); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param ValueObjectInterface $object |
||
38 | * @param string|null $format |
||
39 | * @param array $context |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function normalize($object, $format = null, array $context = []) |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param mixed $data |
||
49 | * @param string|null $format |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function supportsNormalization($data, $format = null) |
||
55 | } |
||
56 | } |
||
57 |