| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class CallableDefinition implements DefinitionInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var array|callable |
||
| 18 | * @psalm-var callable|array{0:class-string,1:string} |
||
| 19 | */ |
||
| 20 | private $method; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param array|callable $method |
||
| 24 | * |
||
| 25 | * @psalm-param callable|array{0:class-string,1:string} $method |
||
| 26 | */ |
||
| 27 | 3 | public function __construct($method) |
|
| 30 | 3 | } |
|
| 31 | |||
| 32 | 3 | public function resolve(ContainerInterface $container) |
|
| 33 | { |
||
| 34 | 3 | $callable = $this->prepareCallable($this->method, $container); |
|
| 35 | |||
| 36 | /** @psalm-suppress MixedMethodCall */ |
||
| 37 | 3 | return $container->get(Injector::class)->invoke($callable); |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param array|callable $callable |
||
| 42 | * |
||
| 43 | * @psalm-param callable|array{0:class-string,1:string} $callable |
||
| 44 | */ |
||
| 45 | 3 | private function prepareCallable($callable, ContainerInterface $container): callable |
|
| 56 | } |
||
| 57 | } |
||
| 58 |