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

ConfigTrait::setParameterBag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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