ConfigurationResolver   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 49
ccs 12
cts 12
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDefaultType() 0 3 1
A getViewTypes() 0 3 1
A getResolvableTypes() 0 3 1
A getTypeName() 0 3 1
1
<?php
2
3
namespace Povs\ListerTwigBundle\Service;
4
5
use Povs\ListerTwigBundle\DependencyInjection\Configuration;
6
use Symfony\Component\Config\Definition\Processor;
7
8
/**
9
 * @author Povilas Margaiatis <[email protected]>
10
 */
11
class ConfigurationResolver
12
{
13
    /**
14
     * @var array
15
     */
16
    private $configuration;
17
18
    /**
19
     * ConfigurationResolver constructor.
20
     *
21
     * @param array $configs
22
     */
23 8
    public function __construct(array $configs)
24
    {
25 8
        $configuration = new Configuration();
26 8
        $processor = new Processor();
27 8
        $this->configuration = $processor->processConfiguration($configuration, $configs);
28
    }
29
30
    /**
31
     * @return array
32
     */
33 2
    public function getViewTypes(): array
34
    {
35 2
        return $this->configuration['view_types'];
36
    }
37
38
    /**
39
     * @return string
40
     */
41 2
    public function getDefaultType(): string
42
    {
43 2
        return $this->configuration['default_type'];
44
    }
45
46
    /**
47
     * @return array
48
     */
49 2
    public function getResolvableTypes(): array
50
    {
51 2
        return $this->configuration['resolvable_types'];
52
    }
53
54
    /**
55
     * @return string
56
     */
57 2
    public function getTypeName(): string
58
    {
59 2
        return $this->configuration['request']['type'];
60
    }
61
}
62