Passed
Push — master ( b55707...d25a23 )
by Mikael
01:58
created

ContainerInjectableTrait::setDI()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Anax\DI;
4
5
use Psr\Container\ContainerInterface;
6
7
/**
8
 * Trait to implement the ContainerInjectableInterface that allows a class
9
 * to be injected with $di.
10
 */
11
trait ContainerInjectableTrait
12
{
13
    /**
14
     * @var ContainerInterface $di the dependency/service container.
15
     */
16
    protected $di;
17
18
19
20
    /**
21
     * Set the dependency/service container to use.
22
     *
23
     * @param ContainerInterface $di a dependency/service container
24
     *
25
     * @return self
26
     */
27
    public function setDI(ContainerInterface $di)
28
    {
29
        $this->di = $di;
30
        return $this;
31
    }
32
}
33