Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class InputParam implements ParamInterface |
||
13 | { |
||
14 | private readonly string $type; |
||
15 | private readonly bool $isDefaultAvailable; |
||
16 | private readonly mixed $defaultValue; |
||
17 | private readonly InputParamFactory $factory; |
||
18 | |||
19 | public function __construct( |
||
20 | ReflectionNamedType $type, |
||
21 | private readonly ReflectionParameter $parameter, |
||
22 | ) { |
||
23 | $this->type = $type->getName(); |
||
|
|||
24 | $this->isDefaultAvailable = $parameter->isDefaultValueAvailable(); |
||
25 | $this->defaultValue = $this->isDefaultAvailable ? $parameter->getDefaultValue() : null; |
||
26 | $inputIterator = new InputAttributeIterator(); |
||
27 | $this->factory = new InputParamFactory( |
||
28 | new InputParamEnumHandler(), |
||
29 | new InputParamObjectHandler($inputIterator), |
||
30 | $inputIterator, |
||
31 | ); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritDoc} |
||
36 | */ |
||
37 | |||
38 | /** @param array<string, mixed> $query */ |
||
39 | public function __invoke(string $varName, array $query, InjectorInterface $injector): mixed |
||
49 | ); |
||
50 | } |
||
52 |