| Conditions | 7 |
| Paths | 10 |
| Total Lines | 25 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | protected function xmlDeserialize($xml) |
||
| 18 | { |
||
| 19 | $array = []; |
||
| 20 | |||
| 21 | if (!$xml instanceof SimpleXMLElement) |
||
| 22 | { |
||
| 23 | $xml = new SimpleXMLElement($xml); |
||
| 24 | } |
||
| 25 | |||
| 26 | foreach ($xml->children() as $key => $child) |
||
| 27 | { |
||
| 28 | $value = (string) $child; |
||
| 29 | $_children = $this->xmlDeserialize($child); |
||
| 30 | $_push = ( $_hasChild = ( count($_children) > 0 ) ) ? $_children : $value; |
||
| 31 | |||
| 32 | if ( $_hasChild && !empty($value) && $value !== '' ) |
||
| 33 | { |
||
| 34 | $_push[] = $value; |
||
| 35 | } |
||
| 36 | |||
| 37 | $array[$key] = $_push; |
||
| 38 | } |
||
| 39 | |||
| 40 | return $array; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |