protected function pushFormField(&$fields, $form, $name, $values)
    {
        $field = $form->filterXPath(sprintf('.//*[@name=%s]', Crawler::xpathLiteral($name)));

        if ($field->count()) {
            $fields[] = [$field, $values];
        } elseif (is_array($values)) {
            foreach ($values as $key => $value) {
                $this->pushFormField($fields, $form, "{$name}[$key]", $value);
            }
        } else {
            throw new ElementNotFound(
                sprintf('//*[@name=%s]', Crawler::xpathLiteral($name)),
                'Form'
            );
        }
    }
protected function pushFormField(&$fields, $form, $name, $values)
    {
        $field = $form->filterXPath(sprintf('.//*[@name=%s]', Crawler::xpathLiteral($name)));

        if ($field->count()) {
            $fields[] = [$field, $values];
        } elseif (is_array($values)) {
            foreach ($values as $key => $value) {
                $this->pushFormField($fields, $form, "{$name}[$key]", $value);
            }
        } else {
            throw new ElementNotFound(
                sprintf('//*[@name=%s]', Crawler::xpathLiteral($name)),
                'Form'
            );
        }
    }
protected function pushFormField ( & $ fields , $ form , $ name , $ values ) { $ field = $ form -> filterXPath ( sprintf ( './/*[@name=%s]' , Crawler :: xpathLiteral ( $ name ) ) ) ; if ( $ field -> count ( ) ) { $ fields [ ] = [ $ field , $ values ] ; } elseif ( is_array ( $ values ) ) { foreach ( $ values as $ key => $ value ) { $ this -> pushFormField ( $ fields , $ form , "{$name}[$key]" , $ value ) ; } } else { throw new ElementNotFound ( sprintf ( '//*[@name=%s]' , Crawler :: xpathLiteral ( $ name ) ) , 'Form' ) ; } }
Map an array element passed to seeInFormFields to its corresponding field,
recursing through array values if the field is not found.

@param array $fields The previously found fields.
@param Crawler $form The form in which to search for fields.
@param string $name The field's name.
@param mixed $values
@return void
Map an array element passed to seeInFormFields to its corresponding field recursing through array values if the field is not found .