| Conditions | 3 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | public function addMethodCall(string $method, array $parameters = []) |
||
| 19 | { |
||
| 20 | $current = $this->getMethodCall(); |
||
| 21 | $newCallback = |
||
| 22 | function ($instance, ContainerInterface $container) use ($current, $method, $parameters) { |
||
| 23 | $_parameters = (new ArrayDefinition($parameters))->getConcrete($container); |
||
| 24 | $current($instance, $container); |
||
| 25 | if (!is_object($instance) || !method_exists($instance, $method)) { |
||
| 26 | throw DefinitionException::invalidMethodCall($this, $instance, $method); |
||
|
|
|||
| 27 | } |
||
| 28 | call_user_func_array([$instance, $method], $_parameters); |
||
| 29 | }; |
||
| 30 | $this->methodsCallback = $newCallback; |
||
| 31 | return $this; |
||
| 32 | } |
||
| 40 |