MongoDBMigrationsExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 12
ccs 0
cts 7
cp 0
crap 6
rs 10
1
<?php
2
3
/*
4
 * This file is part of the AntiMattr MongoDB Migrations Bundle, a library by Matthew Fitzgerald.
5
 *
6
 * (c) 2014 Matthew Fitzgerald
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 AntiMattr\Bundle\MongoDBMigrationsBundle\DependencyInjection;
13
14
use Symfony\Component\Config\FileLocator;
15
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18
19
/**
20
 * @author Matthew Fitzgerald <[email protected]>
21
 */
22
class MongoDBMigrationsExtension extends Extension
23
{
24
    /**
25
     * Responds to the migrations configuration parameter.
26
     *
27
     * @param array            $configs
28
     * @param ContainerBuilder $container
29
     */
30
    public function load(array $configs, ContainerBuilder $container)
31
    {
32
        $configuration = new Configuration();
33
34
        $config = $this->processConfiguration($configuration, $configs);
35
36
        foreach ($config as $key => $value) {
37
            $container->setParameter($this->getAlias() . '.' . $key, $value);
38
        }
39
40
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
41
        $loader->load('services.xml');
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getAlias()
48
    {
49
        return 'mongo_db_migrations';
50
    }
51
}
52