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

Breadcrumb

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

function Crawler::links

Returns an array of Link objects for the nodes in the list.

Return value

Link[]

Throws

\InvalidArgumentException If the current node list contains non-DOMElement instances

File

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

Class

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

Namespace

Symfony\Component\DomCrawler

Code

public function links() : array {
    $links = [];
    foreach ($this->nodes as $node) {
        if (!$node instanceof \DOMElement) {
            throw new \InvalidArgumentException(\sprintf('The current node list should contain only DOMElement instances, "%s" found.', get_debug_type($node)));
        }
        $links[] = new Link($node, $this->baseHref, 'get');
    }
    return $links;
}
RSS feed
Powered by Drupal