first() public method

Returns the first node of the current selection.
public first ( ) : Crawler
return Crawler A Crawler instance with the first selected node
 /**
  * Returns the DomCrawler\Form object for the form pointed to by
  * $node or its closes form parent.
  *
  * @param \Symfony\Component\DomCrawler\Crawler $node
  * @return \Symfony\Component\DomCrawler\Form
  */
 protected function getFormFor(Crawler $node)
 {
     if (strcasecmp($node->first()->getNode(0)->tagName, 'form') === 0) {
         $form = $node->first();
     } else {
         $form = $node->parents()->filter('form')->first();
     }
     if (!$form) {
         $this->fail('The selected node is not a form and does not have a form ancestor.');
     }
     $action = (string) $this->getFormUrl($form);
     if (!isset($this->forms[$action])) {
         $this->forms[$action] = $this->getFormFromCrawler($form, $action);
     }
     return $this->forms[$action];
 }