Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
44 | 1 | private function dataToNodes(\DOMDocument $document, \DOMNode $listNode, array $data) |
|
45 | { |
||
46 | 1 | foreach ($data as $key => $value) { |
|
47 | 1 | if (is_array($value)) { |
|
48 | 1 | $childNode = $document->createElement(is_int($key) ? Inflector::singularize($listNode->nodeName) : $key); |
|
49 | 1 | $this->dataToNodes($document, $childNode, $value); |
|
50 | } else { |
||
51 | 1 | $childNode = $document->createElement($key, $value); |
|
52 | } |
||
53 | |||
54 | 1 | $listNode->appendChild($childNode); |
|
55 | } |
||
56 | 1 | } |
|
57 | } |
||
58 |