protected convertXmlToArray ( string | SimpleXMLElement $xml ) : array | ||
$xml | string | SimpleXMLElement | xml to process. |
return | array | XML array representation. |
protected function convertXmlToArray($xml)
{
if (!is_object($xml)) {
$xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
}
$result = (array) $xml;
foreach ($result as $key => $value) {
if (is_object($value)) {
$result[$key] = $this->convertXmlToArray($value);
}
}
return $result;
}