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

ValueDefinition::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\Container;
8
use yii\di\contracts\DefinitionInterface;
9
10
class ValueDefinition implements DefinitionInterface
11
{
12
    private $value;
13
14
    public function __construct($value)
15
    {
16
        $this->value = $value;
17
    }
18
19
    /**
20
     * @param Container $container
21
     */
22
    public function resolve(ContainerInterface $container, array $params = [])
23
    {
24
        return $this->value;
25
    }
26
27
    /**
28
     * This is used to detect circular reference.
29
     * If a concrete reference is guaranteed to never be part of such a circle
30
     * (for example because it references a simple value) NULL should be returned
31
     * @return string|null A string uniquely identifying a service in the container
32
     */
33
    public function getId(): ?string
34
    {
35
        return null;
36
    }
37
}
38