1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Symfony\Component\DomCrawler\Field;
- class InputFormField extends FormField
- {
-
- protected function initialize()
- {
- if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) {
- throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
- }
- $type = strtolower($this->node->getAttribute('type'));
- if ('checkbox' === $type) {
- throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
- }
- if ('file' === $type) {
- throw new \LogicException('File inputs should be instances of FileFormField.');
- }
- $this->value = $this->node->getAttribute('value');
- }
- }
|