Total Complexity | 3 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | final class XmlSerializer implements SerializerInterface |
||
15 | { |
||
16 | private Serializer $serializer; |
||
17 | |||
18 | /** |
||
19 | * @param string $rootTag The name of the root element. |
||
20 | * @param string $version The XML version. |
||
21 | * @param string $encoding The XML encoding. |
||
22 | */ |
||
23 | public function __construct(string $rootTag = 'response', string $version = '1.0', string $encoding = 'UTF-8') |
||
24 | { |
||
25 | $this->serializer = new Serializer([new ObjectNormalizer()], [new XmlEncoder([ |
||
26 | XmlEncoder::ROOT_NODE_NAME => $rootTag, |
||
27 | XmlEncoder::VERSION => $version, |
||
28 | XmlEncoder::ENCODING => $encoding, |
||
29 | ])]); |
||
30 | } |
||
31 | |||
32 | public function serialize($value): string |
||
35 | } |
||
36 | |||
37 | public function unserialize(string $value) |
||
42 |