| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | 3 | public function resolveArguments(ContextFunction $reflection, array $parameters = []): array |
|
| 43 | { |
||
| 44 | 3 | $arguments = []; |
|
| 45 | |||
| 46 | 3 | foreach ($reflection->getParameters() as $parameter) { |
|
| 47 | 3 | $type = $parameter->getType(); |
|
| 48 | |||
| 49 | 3 | if (null === $type) { |
|
| 50 | 1 | throw new ContainerException(sprintf('Please set type param: %s', $parameter->getName())); |
|
| 51 | } |
||
| 52 | |||
| 53 | 2 | if (!$type instanceof \ReflectionNamedType) { |
|
| 54 | 1 | throw new ContainerException(sprintf('Not supported union type, param:%s', $parameter->getName())); |
|
| 55 | } |
||
| 56 | |||
| 57 | 1 | $arguments[$parameter->getName()] = $this->container->get($type->getName()); |
|
| 58 | } |
||
| 59 | |||
| 60 | 1 | return $arguments; |
|
| 61 | } |
||
| 63 |