Completed
Push — master ( b0867d...8ab030 )
by Alexander
24s queued 11s
created

CallableDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 13
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 4 1
A __construct() 0 3 1
1
<?php
2
namespace yii\di\definitions;
3
4
use Psr\Container\ContainerInterface;
5
use yii\di\Container;
6
use yii\di\contracts\Definition;
7
8
class CallableDefinition implements Definition
9
{
10
    private $method;
11
12
    public function __construct(callable $method)
13
    {
14
        $this->method = $method;
15
    }
16
17
    public function resolve(ContainerInterface $container, array $params = [])
18
    {
19
        $callback = $this->method;
20
        return $callback($container, $params);
21
    }
22
}
23