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

ValueDefinition   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 23
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A resolve() 0 3 1
A getId() 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 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