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 |
|
49 | |||
50 | /** |
||
51 | * @param \DOMDocument $document |
||
52 | * @param \DOMNode $listNode |
||
53 | * @param array $data |
||
54 | */ |
||
55 | 1 | private function dataToNodes(\DOMDocument $document, \DOMNode $listNode, array $data) |
|
77 | |||
78 | /** |
||
79 | * @param bool|float|int $value |
||
80 | * |
||
81 | * @return string|null |
||
82 | * |
||
83 | * @throws \InvalidArgumentException |
||
84 | */ |
||
85 | 1 | private function getValueAsString($value): string |
|
97 | |||
98 | /** |
||
99 | * @param bool|float|int|string $value |
||
100 | * |
||
101 | * @return null|string |
||
102 | */ |
||
103 | 1 | private function getType($value): string |
|
123 | } |
||
124 |