PluginProbe
BeyondWords – AI audio for publishers / 4.5.1
BeyondWords – AI audio for publishers v4.5.1
7.2.0 7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 All 44 releases
speechkit / vendor / symfony / dom-crawler / Field / InputFormField.php

InputFormField.php in BeyondWords – AI audio for publishers 4.5.1, at vendor/symfony/dom-crawler/Field/InputFormField.php

47 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DomCrawler\Field;
13
14 /**
15 * InputFormField represents an input form field (an HTML input tag).
16 *
17 * For inputs with type of file, checkbox, or radio, there are other more
18 * specialized classes (cf. FileFormField and ChoiceFormField).
19 *
20 * @author Fabien Potencier <[email protected]>
21 */
22 class InputFormField extends FormField
23 {
24 /**
25 * Initializes the form field.
26 *
27 * @throws \LogicException When node type is incorrect
28 */
29 protected function initialize()
30 {
31 if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) {
32 throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
33 }
34
35 $type = strtolower($this->node->getAttribute('type'));
36 if ('checkbox' === $type) {
37 throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
38 }
39
40 if ('file' === $type) {
41 throw new \LogicException('File inputs should be instances of FileFormField.');
42 }
43
44 $this->value = $this->node->getAttribute('value');
45 }
46 }
47