1 | <?php |
||
9 | final class XmlTransformer implements TransformerInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var bool |
||
13 | */ |
||
14 | private $formatOutput; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | private $options; |
||
20 | |||
21 | /** |
||
22 | * @param bool $formatOutput |
||
23 | * @param int $options |
||
24 | */ |
||
25 | 1 | public function __construct(bool $formatOutput = false, int $options = LIBXML_NOEMPTYTAG) |
|
30 | |||
31 | /** |
||
32 | * @param array $data |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | 1 | public function transform(array $data): string |
|
45 | |||
46 | /** |
||
47 | * @param \DOMDocument $document |
||
48 | * @param \DOMNode $listNode |
||
49 | * @param array $data |
||
50 | */ |
||
51 | 1 | private function dataToNodes(\DOMDocument $document, \DOMNode $listNode, array $data) |
|
73 | |||
74 | /** |
||
75 | * @param bool|float|int $value |
||
76 | * |
||
77 | * @return string|null |
||
78 | * |
||
79 | * @throws \InvalidArgumentException |
||
80 | */ |
||
81 | 1 | private function getValueAsString($value): string |
|
93 | |||
94 | /** |
||
95 | * @param bool|float|int|string $value |
||
96 | * |
||
97 | * @return null|string |
||
98 | */ |
||
99 | 1 | private function getType($value): string |
|
119 | } |
||
120 |