Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | class VersionedDocumentationNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface |
||
24 | { |
||
25 | private DocumentationNormalizer $decorated; |
||
26 | |||
27 | public function __construct(DocumentationNormalizer $decorated) |
||
28 | { |
||
29 | $this->decorated = $decorated; |
||
30 | } |
||
31 | |||
32 | public function hasCacheableSupportsMethod(): bool |
||
33 | { |
||
34 | return $this->decorated->hasCacheableSupportsMethod(); |
||
35 | } |
||
36 | |||
37 | public function normalize($object, string $format = null, array $context = []) |
||
38 | { |
||
39 | $doc = $this->decorated->normalize($object, $format, $context); |
||
40 | if ('' !== $object->getVersion()) { |
||
41 | $doc['info'] = ['version' => $object->getVersion()]; |
||
42 | } |
||
43 | |||
44 | return $doc; |
||
45 | } |
||
46 | |||
47 | public function supportsNormalization($data, string $format = null): bool |
||
50 | } |
||
51 | } |
||
52 |