Neos\Neos\Service\HtmlAugmenter::getHtmlRootElement PHP Метод

getHtmlRootElement() защищенный Метод

Detects a unique root tag in the given $html string and returns its DOMNode representation - or NULL if no unique root element could be found
protected getHtmlRootElement ( string $html ) : DOMNode
$html string
Результат DOMNode
    protected function getHtmlRootElement($html)
    {
        if (trim($html) === '') {
            return null;
        }
        $domDocument = new \DOMDocument('1.0', 'UTF-8');
        // ignore parsing errors
        $useInternalErrorsBackup = libxml_use_internal_errors(true);
        $domDocument->loadHTML($html);
        $xPath = new \DOMXPath($domDocument);
        $rootElement = $xPath->query('//html/body/*');
        if ($useInternalErrorsBackup !== true) {
            libxml_use_internal_errors($useInternalErrorsBackup);
        }
        if ($rootElement === false || $rootElement->length !== 1) {
            return null;
        }
        return $rootElement->item(0);
    }