Passed
Push — master ( c43998...0c2098 )
by Mikael
02:24
created

ContainerInjectableTrait::setDI()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
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
    public function setDI(ContainerInterface $di)
28
    {
29
        $this->di = $di;
30
        return $this;
31
    }
32
}
33