FastFeed\Tests\Parser\AbstractRSSParserTest::getFirstValueFromXpath PHP Method

getFirstValueFromXpath() protected method

protected getFirstValueFromXpath ( $content, $query ) : string
$content
$query
return string
    protected function getFirstValueFromXpath($content, $query)
    {
        try {
            $dom = new \DOMDocument();
            $dom->loadXML(trim($content));
            $xpath = new \DOMXPath($dom);
            $result = $xpath->query($query);
            if ($result->length) {
                return $result->item(0)->nodeValue;
            }
        } catch (\Exception $e) {
        }
        return false;
    }
AbstractRSSParserTest