JoliTypo\Fixer::loadDOMDocument PHP Method

loadDOMDocument() private method

private loadDOMDocument ( $content ) : DOMDocument
$content
return DOMDocument
    private function loadDOMDocument($content)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->encoding = 'UTF-8';
        $dom->strictErrorChecking = false;
        $dom->substituteEntities = false;
        $dom->formatOutput = false;
        // Change mb and libxml config
        $libxmlCurrent = libxml_use_internal_errors(true);
        $mbDetectCurrent = mb_detect_order();
        mb_detect_order('ASCII,UTF-8,ISO-8859-1,windows-1252,iso-8859-15');
        $loaded = $dom->loadHTML($this->fixContentEncoding($content));
        // Restore mb and libxml config
        libxml_use_internal_errors($libxmlCurrent);
        mb_detect_order(implode(',', $mbDetectCurrent));
        if (!$loaded) {
            throw new InvalidMarkupException("Can't load the given HTML via DomDocument");
        }
        return $dom;
    }