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\DomCrawlerCode
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;
}