Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| SingleInput | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\Components\Forms; |
| 3 | |
| 4 | use Apie\Core\Attributes\CmsSingleInput; |
| 5 | use Apie\Core\Attributes\CmsValidationCheck; |
| 6 | use Apie\Core\Translator\Lists\TranslationStringSet; |
| 7 | use Apie\Core\TypeUtils; |
| 8 | use Apie\HtmlBuilders\Components\BaseComponent; |
| 9 | use Apie\HtmlBuilders\ValueObjects\FormName; |
| 10 | use ReflectionType; |
| 11 | |
| 12 | class SingleInput extends BaseComponent |
| 13 | { |
| 14 | /** |
| 15 | * @param array<CmsValidationCheck|array<string, mixed>> $validationChecks |
| 16 | */ |
| 17 | public function __construct( |
| 18 | FormName $name, |
| 19 | mixed $value, |
| 20 | TranslationStringSet $label, |
| 21 | bool $nullable, |
| 22 | ReflectionType $type, |
| 23 | CmsSingleInput $input, |
| 24 | array $validationChecks = [], |
| 25 | ) { |
| 26 | parent::__construct( |
| 27 | [ |
| 28 | 'name' => $name, |
| 29 | 'value' => $value, |
| 30 | 'label' => $label, |
| 31 | 'nullable' => $nullable, |
| 32 | 'allowsEmptyString' => TypeUtils::allowEmptyString($type), |
| 33 | 'types' => $input->types, |
| 34 | 'options' => $input->options->forType($type), |
| 35 | 'validationChecks' => $validationChecks, |
| 36 | ] |
| 37 | ); |
| 38 | } |
| 39 | } |