| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 17 | protected function validate($input): Text |
||
| 18 | { |
||
| 19 | $settings = $this->getSettings(); |
||
| 20 | $choices = $settings['choices'] ?? []; |
||
| 21 | |||
| 22 | Assertion::notEmpty($choices, 'Available choices must be specified.'); |
||
| 23 | Assertion::inArray($input, $choices, 'Not a valid choice.'); |
||
| 24 | |||
| 25 | return Text::fromNative($input); |
||
| 26 | } |
||
| 28 |