FastFeed\Tests\Aggregator\RSSContentAggregatorTest::getFirstValueFromXpath PHP Méthode

getFirstValueFromXpath() protected méthode

protected getFirstValueFromXpath ( $content, $query ) : string
$content
$query
Résultat 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;
    }