Completed
Push — master ( f90a91...0e6e53 )
by Mikael
10:56
created

ContainerInjectableTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 22
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setDI() 0 5 1
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