Passed
Push — master ( f3c67a...8e7fe7 )
by Evgeniy
14:18 queued 10s
created

Definition::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cekta\DI\Strategy;
6
7
use Psr\Container\ContainerInterface;
8
9
class Definition extends KeyValue
10
{
11
    /**
12
     * @var ContainerInterface
13
     */
14
    private $container;
15
16
    public function __construct(array $values, ContainerInterface $container)
17
    {
18
        parent::__construct($values);
19
        $this->container = $container;
20
    }
21
22
    public function get($id)
23
    {
24
        $result = parent::get($id);
25
        if (is_callable($result)) {
26
            $result = $result($this->container);
27
        }
28
        return $result;
29
    }
30
}
31