Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ArrayComponentProvider
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 supports
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 createComponentFor
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\HtmlBuilders\Factories\Concrete;
3
4use Apie\Core\Lists\ItemHashmap;
5use Apie\HtmlBuilders\FormBuildContext;
6use Apie\HtmlBuilders\Interfaces\ComponentInterface;
7use Apie\HtmlBuilders\Interfaces\FormComponentProviderInterface;
8use Apie\TypeConverter\ReflectionTypeFactory;
9use ReflectionNamedType;
10use ReflectionType;
11
12final 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}