Completed
Push — standalone ( 64a47f...7c3a2c )
by Philip
06:01 queued 28s
created

DdrRestExtension::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
ccs 11
cts 11
cp 1
rs 9.4285
cc 2
eloc 10
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Dontdrinkandroot\RestBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
class DdrRestExtension extends Extension
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 4
    public function load(array $configs, ContainerBuilder $container)
16
    {
17 4
        $configuration = new Configuration();
18 4
        $config = $this->processConfiguration($configuration, $configs);
19
20 4
        $container->setParameter('ddr.rest.paths', $config['paths']);
21
22 4
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
23 4
        $loader->load('services.yml');
24
25 4
        if (null !== $config['access_token_class']) {
26 2
            $container->setParameter('ddr.rest.access_token_class', $config['access_token_class']);
27 2
            $container->setParameter('ddr.rest.authentication_provider_key', $config['authentication_provider_key']);
28
29 2
            $loader->load('services_security.yml');
30
        }
31 4
    }
32
}
33