Completed
Push — master ( 3f1d1d...0341ae )
by Matze
05:15
created

ConfigTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParameter() 0 4 1
A setParameterBag() 0 4 1
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
use BrainExe\Core\Annotations\Inject;
6
use Symfony\Component\DependencyInjection\Container;
7
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
8
9
/**
10
 * @api
11
 */
12
trait ConfigTrait
13
{
14
    /**
15
     * @var ParameterBag
16
     */
17
    private $parameterBag;
18
19
    /**
20
     * @Inject("=container.getParameterBag()")
21
     * @param ParameterBag $parameterBag
22
     */
23 2
    public function setParameterBag(ParameterBag $parameterBag)
24
    {
25 2
        $this->parameterBag = $parameterBag;
26 2
    }
27
28
    /**
29
     * @param string $parameterId
30
     * @return mixed
31
     */
32 1
    protected function getParameter(string $parameterId)
33
    {
34 1
        return $this->parameterBag->get($parameterId);
35
    }
36
}
37