private static function addChildren(SimpleXMLElement $xml) { $properties = array(); foreach ($xml as $child) { if (count($child->children()) > 0) { $children = self::addChildren($child); if (AkInflector::isCollectionOf($child->getName(), $xml->getName())) { $properties[] = $children; } else { $properties[$child->getName()] = $children; } } else { $properties[$child->getName()] = (string) $child; } } return $properties; }