src/Parser.php
public static function getElementText(DOMElement $element, $concat = true)
    {
        $textNodes = [];

        foreach ($element->xpath('./text()') as $text) {
            if ($value = static::clearValue($text->nodeValue)) {
                $textNodes[] = $value;
            }
        }
        return $concat ? implode($textNodes) : $textNodes;
    }
public static function getElementText(DOMElement $element, $concat = true)
    {
        $textNodes = [];

        foreach ($element->xpath('./text()') as $text) {
            if ($value = static::clearValue($text->nodeValue)) {
                $textNodes[] = $value;
            }
        }
        return $concat ? implode($textNodes) : $textNodes;
    }
public static function getElementText ( DOMElement $ element , $ concat = true ) { $ textNodes = [ ] ; foreach ( $ element -> xpath ( './text()' ) as $ text ) { if ( $ value = static :: clearValue ( $ text -> nodeValue ) ) { $ textNodes [ ] = $ value ; } } return $ concat ? implode ( $ textNodes ) : $ textNodes ; }
Get the text of a `DOMElement` excluding the contents
of its child elements.

@param DOMElement $element
@param bool $concat

@return string|array returns an array of strings if `$concat` is `false`
Get the text of a DOMElement excluding the contents of its child elements .