Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Crawler.php

function Crawler::image

Returns an Image object for the first node in the list.

Throws

\InvalidArgumentException If the current node list is empty

File

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

Class

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

Namespace

Symfony\Component\DomCrawler

Code

public function image() : Image {
    if (!\count($this)) {
        throw new \InvalidArgumentException('The current node list is empty.');
    }
    $node = $this->getNode(0);
    if (!$node instanceof \DOMElement) {
        throw new \InvalidArgumentException(\sprintf('The selected node should be instance of DOMElement, got "%s".', get_debug_type($node)));
    }
    return new Image($node, $this->baseHref);
}
RSS feed
Powered by Drupal