SamlSpFactoryConfiguration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 1
cbo 3
dl 0
loc 69
ccs 25
cts 25
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getConfigTreeBuilder() 0 7 1
A processConfiguration() 0 9 1
A processCommonConfiguration() 0 4 1
A getCommonConfiguration() 0 18 1
1
<?php
2
3
namespace AerialShip\SamlSPBundle\Tests\DependencyInjection\Security;
4
5
use AerialShip\SamlSPBundle\DependencyInjection\Security\Factory\SamlSpFactory;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
use Symfony\Component\Config\Definition\Processor;
9
10
class SamlSpFactoryConfiguration implements ConfigurationInterface
11
{
12
    /** @var \AerialShip\SamlSPBundle\DependencyInjection\Security\Factory\SamlSpFactory  */
13
    private $factory;
14
15
    /** @var  string */
16
    private $name;
17
18
19
20 13
    public function __construct(SamlSpFactory $factory, $name)
21
    {
22 13
        $this->factory = $factory;
23 13
        $this->name = $name;
24 13
    }
25
26
    /**
27
     * Generates the configuration tree builder.
28
     *
29
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
30
     */
31 13
    public function getConfigTreeBuilder()
32
    {
33 13
        $treeBuilder = new TreeBuilder();
34 13
        $rootNode = $treeBuilder->root($this->name);
35 13
        $this->factory->addConfiguration($rootNode);
36 13
        return $treeBuilder;
37
    }
38
39
40
    /**
41
     * @param array $config
42
     * @return array
43
     */
44 13
    public function processConfiguration(array $config)
45
    {
46 13
        $processor = new Processor();
47 13
        $result = $processor->processConfiguration(
48 13
            $this,
49 13
            array($this->name => $config)
50 13
        );
51 13
        return $result;
52
    }
53
54
55 9
    public function processCommonConfiguration()
56
    {
57 9
        return $this->processConfiguration($this->getCommonConfiguration());
58
    }
59
60 13
    public function getCommonConfiguration()
61
    {
62
        return array(
63
            'services' => array(
64
                'aaa' => array(
65
                    'idp' => array(
66
                        'file' => 'name.xml'
67 13
                    ),
68
                    'sp' => array(
69
                        'config' => array(
70
                            'entity_id' => 'entity.id'
71 13
                        )
72 13
                    )
73 13
                )
74 13
            )
75 13
        );
76
77
    }
78
}
79