| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | class PreviewNormalizer implements NormalizerInterface |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | * |
||
| 29 | * @var Index $object A sanity index entity |
||
| 30 | */ |
||
| 31 | public function normalize($object, $format = null, array $context = []) |
||
| 32 | { |
||
| 33 | $indexValueNormalized = $object->getValue(); |
||
| 34 | |||
| 35 | $tags = $object->getTags(); |
||
| 36 | $tagsNormalized = []; |
||
| 37 | |||
| 38 | foreach ($tags as $tag) { |
||
| 39 | $tagName = $tag->getName(); |
||
| 40 | $tagDescription = $tag->getDescription(); |
||
| 41 | |||
| 42 | $tagsNormalized[] = ['name' => $tagName, 'description' => $tagDescription]; |
||
| 43 | } |
||
| 44 | |||
| 45 | return [ |
||
| 46 | 'value' => $indexValueNormalized, |
||
| 47 | 'tags' => $tagsNormalized, |
||
| 48 | ]; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | public function supportsNormalization($data, $format = null) |
||
| 57 | } |
||
| 58 | } |
||
| 59 |