| Total Complexity | 6 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class UuidNormalizer implements NormalizerInterface, DenormalizerInterface |
||
| 10 | { |
||
| 11 | public function denormalize($data, $type, $format = null, array $context = []) |
||
| 12 | { |
||
| 13 | return Uuid::fromString($data); |
||
| 14 | } |
||
| 15 | |||
| 16 | public function supportsDenormalization($data, $type, $format = null) |
||
| 17 | { |
||
| 18 | return (Uuid::class === $type || UuidInterface::class === $type) && is_string($data); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritdoc} |
||
| 23 | */ |
||
| 24 | public function normalize($object, $format = null, array $context = array()) |
||
| 25 | { |
||
| 26 | return $object->toString(); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * {@inheritdoc} |
||
| 31 | */ |
||
| 32 | public function supportsNormalization($data, $format = null) |
||
| 35 | } |
||
| 36 | } |
||
| 37 |