You are here

public function Crawler::link in Zircon Profile 8

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

Returns a Link object for the first node in the list.

Parameters

string $method The method for the link (get by default):

Return value

Link A Link instance

Throws

\InvalidArgumentException If the current node list is empty

File

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

Class

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

Namespace

Symfony\Component\DomCrawler

Code

public function link($method = 'get') {
  if (!count($this)) {
    throw new \InvalidArgumentException('The current node list is empty.');
  }
  $node = $this
    ->getNode(0);
  return new Link($node, $this->baseHref, $method);
}