public function parse($html)
    {
        $errorHandling = libxml_use_internal_errors(true);

        $dom = new \DOMDocument();
        $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

        $xpath = new \DOMXpath($dom);

        foreach ($this->componentFactories as $tag => $factory) {
            $tags = $xpath->query('//' . $tag);

            if ($tags) {
                foreach ($tags as $node) {
                    $factory->parse($node);
                }
            }
        }

        libxml_clear_errors();
        libxml_use_internal_errors($errorHandling);

        return $dom->saveHTML();
    }
public function parse($html)
    {
        $errorHandling = libxml_use_internal_errors(true);

        $dom = new \DOMDocument();
        $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

        $xpath = new \DOMXpath($dom);

        foreach ($this->componentFactories as $tag => $factory) {
            $tags = $xpath->query('//' . $tag);

            if ($tags) {
                foreach ($tags as $node) {
                    $factory->parse($node);
                }
            }
        }

        libxml_clear_errors();
        libxml_use_internal_errors($errorHandling);

        return $dom->saveHTML();
    }
public function parse ( $ html ) { $ errorHandling = libxml_use_internal_errors ( true ) ; $ dom = new \ DOMDocument ( ) ; $ dom -> loadHTML ( $ html , LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD ) ; $ xpath = new \ DOMXpath ( $ dom ) ; foreach ( $ this -> componentFactories as $ tag => $ factory ) { $ tags = $ xpath -> query ( '//' . $ tag ) ; if ( $ tags ) { foreach ( $ tags as $ node ) { $ factory -> parse ( $ node ) ; } } } libxml_clear_errors ( ) ; libxml_use_internal_errors ( $ errorHandling ) ; return $ dom -> saveHTML ( ) ; }
Parse HTML and replace inky components

@param string $html
@return string
Parse HTML and replace inky components