Completed
Push — master ( efc964...49d6db )
by Mikael
02:34
created

ContainerInjectableTrait::setDI()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Anax\Commons;
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 1
    public function setDI(ContainerInterface $di)
28
    {
29 1
        $this->di = $di;
30 1
        return $this;
31
    }
32
}
33