src/AbstractParser.php
public function getScalarRecords(SimpleXMLElement $element, $asArray = true)
    {
        $data = [];

        //multiple elements
        if ($element->count()) {
            foreach ($element->children() as $name => $property) {
                if (!$property->count()) {
                    $data[$name] = (string)$property;
                }
            }

            return $data;
            //only 1 element
        } elseif ($asArray) {
            return [$element->getName() => (string)$element];
        } else {
            return (string) $element;
        }
    }
public function getScalarRecords(SimpleXMLElement $element, $asArray = true)
    {
        $data = [];

        //multiple elements
        if ($element->count()) {
            foreach ($element->children() as $name => $property) {
                if (!$property->count()) {
                    $data[$name] = (string)$property;
                }
            }

            return $data;
            //only 1 element
        } elseif ($asArray) {
            return [$element->getName() => (string)$element];
        } else {
            return (string) $element;
        }
    }
public function getScalarRecords ( SimpleXMLElement $ element , $ asArray = true ) { $ data = [ ] ; //multiple elements if ( $ element -> count ( ) ) { foreach ( $ element -> children ( ) as $ name => $ property ) { if ( ! $ property -> count ( ) ) { $ data [ $ name ] = ( string ) $ property ; } } return $ data ; //only 1 element } elseif ( $ asArray ) { return [ $ element -> getName ( ) => ( string ) $ element ] ; } else { return ( string ) $ element ; } }
Get all the Scalar records in the current
element. Ignore all nested data. The XPaths should be
used to include this data.

@param SimpleXMLElement $element
@param bool             $asArray If there is only 1 record found from xPath,
whether to return as an array or just the value

@return array
Get all the Scalar records in the current element . Ignore all nested data . The XPaths should be used to include this data .