Conditions | 5 |
Paths | 6 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
50 | public function resolveArgumentsForClosure(\Closure $callback, array $rawArgs): array |
||
51 | { |
||
52 | $result = []; |
||
53 | $refMethod = new \ReflectionMethod($callback, '__invoke'); |
||
54 | foreach ($refMethod->getParameters() as $refParam) { |
||
55 | if (null !== $refClass = $refParam->getClass()) { |
||
56 | if (isset($this->app[$refClass->name])) { |
||
57 | $result[$refParam->getPosition()] = $this->app[$refClass->name]; |
||
58 | |||
59 | continue; |
||
60 | } |
||
61 | } |
||
62 | |||
63 | if (in_array($refParam->name, array_keys($rawArgs))) { |
||
64 | $result[$refParam->getPosition()] = $rawArgs[$refParam->name]; |
||
65 | } |
||
66 | } |
||
67 | |||
68 | return $result; |
||
69 | } |
||
70 | } |
||
71 |