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