Sulu\Component\Content\Metadata\Loader\XmlLegacyLoader::getValueFromXPath PHP Метод

getValueFromXPath() приватный Метод

returns value of path.
private getValueFromXPath ( $path, DOMXPath $xpath, DomNode $context = null, $default = null )
$xpath DOMXPath
$context DomNode
    private function getValueFromXPath($path, \DOMXPath $xpath, \DomNode $context = null, $default = null)
    {
        try {
            $result = $xpath->query($path, $context);
            if ($result->length === 0) {
                return $default;
            }
            $item = $result->item(0);
            if ($item === null) {
                return $default;
            }
            if ('true' === $item->nodeValue) {
                return true;
            }
            if ('false' === $item->nodeValue) {
                return false;
            }
            return $item->nodeValue;
        } catch (Exception $ex) {
            return $default;
        }
    }