| Total Complexity | 4 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | final class Hidden extends InputAttributes |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Generates a hidden input tag for the given form attribute. |
||
| 21 | * |
||
| 22 | * @return string the generated input tag. |
||
| 23 | */ |
||
| 24 | 4 | protected function run(): string |
|
| 25 | { |
||
| 26 | 4 | $attributes = $this->attributes; |
|
| 27 | |||
| 28 | /** @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.hidden.html#input.hidden.attrs.value */ |
||
| 29 | 4 | $value = $attributes['value'] ?? $this->getAttributeValue(); |
|
| 30 | 4 | unset($attributes['value']); |
|
| 31 | |||
| 32 | 4 | <<<<<<< HEAD |
|
|
|
|||
| 33 | 2 | if (!is_string($value) && !is_numeric($value) && !is_null($value)) { |
|
| 34 | throw new InvalidArgumentException('Hidden widget requires a string, numeric or null value.'); |
||
| 35 | ======= |
||
| 36 | 2 | if (!is_string($value) && !is_numeric($value) && null !== $value) { |
|
| 37 | 2 | throw new InvalidArgumentException('Hidden widget requires a string value.'); |
|
| 38 | >>>>>>> 46a5b82f580d84b7c0f2725294a936bf67aedf39 |
||
| 39 | } |
||
| 40 | 2 | ||
| 41 | if (!array_key_exists('name', $attributes)) { |
||
| 48 |