Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
39 | 2 | protected function composeXML($data, &$xml): void |
|
40 | { |
||
41 | 2 | foreach ($data as $key => $value) { |
|
42 | 2 | if (is_array($value)) { |
|
43 | 2 | if (is_numeric($key)) { |
|
44 | 1 | $key = 'item'.$key; |
|
45 | } |
||
46 | |||
47 | 2 | $subnode = $xml->addChild($key); |
|
48 | 2 | $this->composeXML($value, $subnode); |
|
49 | } else { |
||
50 | 2 | $xml->addChild("$key", htmlspecialchars("$value")); |
|
51 | } |
||
52 | } |
||
53 | 2 | } |
|
54 | } |
||
55 |