protected static function xmlToArray(\SimpleXMLElement $xml)/*# : array */
    {
        $arr = array();
        foreach ($xml as $element) {
            $tag = $element->getName();
            $ele = get_object_vars($element);
            if (!empty($ele)) {
                $arr[$tag] = $element instanceof \SimpleXMLElement ?
                    static::xmlToArray($element) :
                    $ele;
            } else {
                $arr[$tag] = trim($element);
            }
        }
        return $arr;
    }
protected static function xmlToArray(\SimpleXMLElement $xml)/*# : array */
    {
        $arr = array();
        foreach ($xml as $element) {
            $tag = $element->getName();
            $ele = get_object_vars($element);
            if (!empty($ele)) {
                $arr[$tag] = $element instanceof \SimpleXMLElement ?
                    static::xmlToArray($element) :
                    $ele;
            } else {
                $arr[$tag] = trim($element);
            }
        }
        return $arr;
    }
protected static function xmlToArray ( \ SimpleXMLElement $ xml ) /*# : array */ { $ arr = array ( ) ; foreach ( $ xml as $ element ) { $ tag = $ element -> getName ( ) ; $ ele = get_object_vars ( $ element ) ; if ( ! empty ( $ ele ) ) { $ arr [ $ tag ] = $ element instanceof \ SimpleXMLElement ? static :: xmlToArray ( $ element ) : $ ele ; } else { $ arr [ $ tag ] = trim ( $ element ) ; } } return $ arr ; }
Convert SimpleXML object to array

@param  \SimpleXMLElement $xml the xml object
@return array
@access protected
@static
Convert SimpleXML object to array