original_string: public function form(array $values = null, $method = null)
      {
          if (!$this->nodes) {
              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_class($node)));
          }
  
          $form = new Form($node, $this->uri, $method, $this->baseHref);
  
          if (null !== $values) {
              $form->setValues($values);
          }
  
          return $form;
      }
code: public function form(array $values = null, $method = null)
      {
          if (!$this->nodes) {
              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_class($node)));
          }
  
          $form = new Form($node, $this->uri, $method, $this->baseHref);
  
          if (null !== $values) {
              $form->setValues($values);
          }
  
          return $form;
      }
code_tokens: public function form ( array $ values = null , $ method = null ) { if ( ! $ this -> nodes ) { 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_class ( $ node ) ) ) ; } $ form = new Form ( $ node , $ this -> uri , $ method , $ this -> baseHref ) ; if ( null !== $ values ) { $ form -> setValues ( $ values ) ; } return $ form ; }
docstring: Returns a Form object for the first node in the list.
  
  @param array  $values An array of values for the form fields
  @param string $method The method for the form
  
  @return Form A Form instance
  
  @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
docstring_tokens: Returns a Form object for the first node in the list .