| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 36 | private function toXml(SimpleXMLElement $object, array $data) { |
||
| 37 | foreach( $data as $key => $value ) { |
||
| 38 | if(is_array($value) ) { |
||
| 39 | if( is_numeric($key) ){ |
||
| 40 | $key = 'item'.$key; //dealing with <0/>..<n/> issues |
||
| 41 | } |
||
| 42 | $subnode = $object->addChild($key); |
||
| 43 | $this->toXml($subnode, $value); |
||
| 44 | } else { |
||
| 45 | $object->addChild("$key",htmlspecialchars("$value")); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 60 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.