DdrRestExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 6
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 22 4
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
/**
11
 * @author Philip Washington Sorst <[email protected]>
12
 */
13
class DdrRestExtension extends Extension
14
{
15
    const ACCESS_TOKEN_CLASS = 'access_token_class';
16
    const AUTHENTICATION_PROVIDER_KEY = 'authentication_provider_key';
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 12
    public function load(array $configs, ContainerBuilder $container)
22
    {
23 12
        $configuration = new Configuration();
24 12
        $config = $this->processConfiguration($configuration, $configs);
25
26 12
        $container->setParameter('ddr_rest.paths', $config['paths']);
27
28 12
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
29 12
        $loader->load('services.xml');
30
31 12
        $directories = [];
32
        #$directories['Dontdrinkandroot\RestBundle'] = realpath(__DIR__ . '/../config/rest/');
33 12
        if (array_key_exists('metadata', $config) && array_key_exists('directories', $config['metadata'])) {
34 12
            foreach ($config['metadata']['directories'] as $directory) {
35 12
                $directories[$directory['namespace_prefix']] = $directory['path'];
36
            }
37
        }
38
39
        $container
40 12
            ->getDefinition('ddr_rest.metadata.file_locator')
41 12
            ->setArguments([$directories]);
42 12
    }
43
}
44