You are here

public function Crawler::html in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Crawler.php \Symfony\Component\DomCrawler\Crawler::html()

Returns the first node of the list as HTML.

Return value

string The node html

Throws

\InvalidArgumentException When current node is empty

File

vendor/symfony/dom-crawler/Crawler.php, line 567

Class

Crawler
Crawler eases navigation of a list of \DOMElement objects.

Namespace

Symfony\Component\DomCrawler

Code

public function html() {
  if (!count($this)) {
    throw new \InvalidArgumentException('The current node list is empty.');
  }
  $html = '';
  foreach ($this
    ->getNode(0)->childNodes as $child) {
    $html .= $child->ownerDocument
      ->saveHTML($child);
  }
  return $html;
}