Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| FormPrototypeHashmap | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\Components\Forms; |
| 3 | |
| 4 | use Apie\HtmlBuilders\Components\BaseComponent; |
| 5 | use Apie\HtmlBuilders\Lists\ComponentHashmap; |
| 6 | use Apie\HtmlBuilders\ValueObjects\FormName; |
| 7 | |
| 8 | class FormPrototypeHashmap extends BaseComponent |
| 9 | { |
| 10 | /** |
| 11 | * @param null|array<string|int, mixed> $value |
| 12 | * @param array<string, string> $validationErrors |
| 13 | */ |
| 14 | public function __construct( |
| 15 | FormName $name, |
| 16 | ?array $value, |
| 17 | string $prototypeName, |
| 18 | BaseComponent $prototype, |
| 19 | array $validationErrors = [], |
| 20 | ) { |
| 21 | $value ??= []; |
| 22 | $prototype = $this->makePrototype($prototypeName, $prototype); |
| 23 | parent::__construct( |
| 24 | [ |
| 25 | 'name' => $name, |
| 26 | 'value' => $value, |
| 27 | 'prototypeName' => $prototypeName, |
| 28 | 'validationErrors' => $validationErrors, |
| 29 | ], |
| 30 | new ComponentHashmap([ |
| 31 | '__proto__' => $prototype, |
| 32 | ]) |
| 33 | ); |
| 34 | } |
| 35 | } |