L10nResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A resolve() 0 8 2
1
<?php
2
3
namespace L10nBundle\Utils\Resolver;
4
5
use Symfony\Component\DependencyInjection\Container;
6
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
7
8
/**
9
 * Resolves the parameters that are used in a value
10
 */
11
class L10nResolver
12
{
13
    /**
14
     * @var ParameterBagInterface
15
     */
16
    protected $parameterBag;
17
18
    /**
19
     * @param Container $container
20
     */
21 4
    public function __construct(Container $container)
22
    {
23 4
        $parameterBag = $container->getParameterBag();
24 4
        $parameterBag->resolve();
25
26 4
        $this->parameterBag = $parameterBag;
27 4
    }
28
29
    /**
30
     * Resolves a value containing parameters to a plain value.
31
     *
32
     * @param mixed $value
33
     *
34
     * @return mixed
35
     */
36 4
    public function resolve($value)
37
    {
38 4
        if (!is_array($value)) {
39 3
            return $this->parameterBag->resolveValue($value);
40
        }
41
42 1
        return null;
43
    }
44
}
45