Passed
Push — master ( 5d2a5f...85042a )
by Enrico
02:59
created

ContainerAwareTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainer() 0 3 1
A setContainer() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the uSilex framework.
5
 *
6
 * (c) Enrico Fagnoni <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace uSilex;
13
14
use Psr\Container\ContainerInterface;
15
use Pimple\Container as PimpleContainer;
16
17
18
/**
19
 * Psr11 trait. Realize a Container aware interfce from a pimple container
20
 *
21
 * @author Enrico Fagnoni <[email protected]>
22
 */
23
trait ContainerAwareTrait
24
{
25
    private $container;
26
    
27 1
    public function __construct(ContainerInterface $container = null)
28
    {
29 1
        $this->container = $container;
30 1
    }
31
    
32 1
    public function getContainer() : ContainerInterface 
33
    {
34 1
        return $this->container;
35
    }
36
    
37
    
38 1
    public function setContainer(ContainerInterface $container) : self 
39
    {
40 1
        $this->container = $container;
41
        
42 1
        return $this;
43
    }
44
}
45