Completed
Push — sam-rework ( a5f68e...28559d )
by Andrii
10:44
created

CallableDefinition::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace yii\di\definitions;
5
6
use Psr\Container\ContainerInterface;
7
use yii\di\contracts\DefinitionInterface;
8
9
class CallableDefinition implements DefinitionInterface
10
{
11
    private $method;
12
13
    public function __construct(callable $method)
14
    {
15
        $this->method = $method;
16
    }
17
18
    /**
19
     * @param ContainerInterface $container
20
     * @param array $params
21
     */
22
    public function resolve(ContainerInterface $container, array $params = [])
23
    {
24
        return $container->getInjector()->invoke($this->method, $params);
0 ignored issues
show
Bug introduced by
The method getInjector() does not exist on Psr\Container\ContainerInterface. It seems like you code against a sub-type of Psr\Container\ContainerInterface such as yii\di\Container or yii\di\AbstractContainer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $container->/** @scrutinizer ignore-call */ getInjector()->invoke($this->method, $params);
Loading history...
25
    }
26
}
27