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