src/DomCrawler/Field/ChoiceFormField.php
protected function initialize()
    {
        $tagName = $this->element->getTagName();
        if ('input' !== $tagName && 'select' !== $tagName) {
            throw new \LogicException(\sprintf('A ChoiceFormField can only be created from an input or select tag (%s given).', $tagName));
        }

        $type = \strtolower($this->element->getAttribute('type'));
        if ('input' === $tagName && 'checkbox' !== $type && 'radio' !== $type) {
            throw new \LogicException(\sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $type));
        }

        $this->type = 'select' === $tagName ? 'select' : $type;
        $this->selector = 'select' === $this->type ? new WebDriverSelect($this->element) : new WebDriverCheckbox($this->element);
    }
protected function initialize()
    {
        $tagName = $this->element->getTagName();
        if ('input' !== $tagName && 'select' !== $tagName) {
            throw new \LogicException(\sprintf('A ChoiceFormField can only be created from an input or select tag (%s given).', $tagName));
        }

        $type = \strtolower($this->element->getAttribute('type'));
        if ('input' === $tagName && 'checkbox' !== $type && 'radio' !== $type) {
            throw new \LogicException(\sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $type));
        }

        $this->type = 'select' === $tagName ? 'select' : $type;
        $this->selector = 'select' === $this->type ? new WebDriverSelect($this->element) : new WebDriverCheckbox($this->element);
    }
protected function initialize ( ) { $ tagName = $ this -> element -> getTagName ( ) ; if ( 'input' !== $ tagName && 'select' !== $ tagName ) { throw new \ LogicException ( \ sprintf ( 'A ChoiceFormField can only be created from an input or select tag (%s given).' , $ tagName ) ) ; } $ type = \ strtolower ( $ this -> element -> getAttribute ( 'type' ) ) ; if ( 'input' === $ tagName && 'checkbox' !== $ type && 'radio' !== $ type ) { throw new \ LogicException ( \ sprintf ( 'A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).' , $ type ) ) ; } $ this -> type = 'select' === $ tagName ? 'select' : $ type ; $ this -> selector = 'select' === $ this -> type ? new WebDriverSelect ( $ this -> element ) : new WebDriverCheckbox ( $ this -> element ) ; }
Initializes the form field.

@throws \LogicException When node type is incorrect
Initializes the form field .