LIN3SKnowledgeBaseExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 14
rs 9.4285
cc 1
eloc 9
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Knowledge Base package.
5
 *
6
 * Copyright (c) 2015 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\KnowledgeBaseBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Processor;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
17
use Symfony\Component\Config\FileLocator;
18
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
19
20
/**
21
 * Class LIN3S Knowledge Base Extension.
22
 *
23
 * Loads configuration and exposes the parameters retrieved from the config as
24
 * 'lin3s_knowledge_base.configuration_parameters'. This will be used by ConfigurationCompilerPass.
25
 *
26
 * @author Gorka Laucirica <[email protected]>
27
 */
28
class LIN3SKnowledgeBaseExtension extends Extension
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function load(array $configs, ContainerBuilder $container)
34
    {
35
        $processor = new Processor();
36
        $configuration = new Configuration();
37
        $config = $processor->processConfiguration($configuration, $configs);
38
        $loader = new YamlFileLoader(
39
            $container,
40
            new FileLocator(__DIR__ . '/../Resources/config')
41
        );
42
43
        $loader->load('services.yml');
44
45
        $container->setParameter('lin3s_knowledge_base.configuration_parameters', $config);
46
    }
47
}
48