Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ArrayComponentProvider | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| createComponentFor | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\Factories\Concrete; |
| 3 | |
| 4 | use Apie\Core\Lists\ItemHashmap; |
| 5 | use Apie\HtmlBuilders\FormBuildContext; |
| 6 | use Apie\HtmlBuilders\Interfaces\ComponentInterface; |
| 7 | use Apie\HtmlBuilders\Interfaces\FormComponentProviderInterface; |
| 8 | use Apie\TypeConverter\ReflectionTypeFactory; |
| 9 | use ReflectionNamedType; |
| 10 | use ReflectionType; |
| 11 | |
| 12 | final class ArrayComponentProvider implements FormComponentProviderInterface |
| 13 | { |
| 14 | public function supports(ReflectionType $type, FormBuildContext $context): bool |
| 15 | { |
| 16 | return $type instanceof ReflectionNamedType && $type->getName() === 'array'; |
| 17 | } |
| 18 | public function createComponentFor(ReflectionType $type, FormBuildContext $context): ComponentInterface |
| 19 | { |
| 20 | return $context->getComponentFactory()->createFromType( |
| 21 | ReflectionTypeFactory::createReflectionType(ItemHashmap::class), |
| 22 | $context |
| 23 | ); |
| 24 | } |
| 25 | } |