/** * Return the HTML content for a template * * @param array $transformers Optional * * @return string */ public function html(array $transformers = array()) { $dom = $this->getDOMDocument(); foreach ($transformers as $selector => $transformer) { $elements = $this->query($dom, $selector); foreach ($elements as $element) { Element::apply($element, array($transformer)); } } return $dom->saveHTML(); }
/** * Returns all the classes from the specified element without * the given class $name * * @param DOMElement $element * @param array $classes * * @return array */ public static function withoutClasses(DOMElement $element, array $classes) { return array_diff(Element::classesFor($element), $classes); }
/** * Return transformer to replace the matched elements with * the specified HTML * * @param string $html * * @return Callable */ public static function replaceWith($html) { return function (DOMElement $element) use($html) { $element->parentNode->replaceChild(Element::forHtmlIn($html, $element->ownerDocument), $element); }; }