Completed
Push — master ( 7a069b...4da1f4 )
by Paweł
11s
created

SWPCoreExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Core Bundle.
5
 *
6
 * Copyright 2015 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\CoreBundle\DependencyInjection;
16
17
use SWP\Bundle\StorageBundle\DependencyInjection\Extension\Extension;
18
use SWP\Bundle\StorageBundle\Drivers;
19
use Symfony\Component\Config\FileLocator;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Loader;
22
23
/**
24
 * This is the class that loads and manages your bundle configuration.
25
 *
26
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
27
 */
28
class SWPCoreExtension extends Extension
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33 2
    public function load(array $configs, ContainerBuilder $container)
34
    {
35 2
        $config = $this->processConfiguration(new Configuration(), $configs);
36 2
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
37 2
        $loader->load('services.yml');
38 2
        $loader->load('twig.yml');
39
        $loader->load('composite_publishing.yml');
40 2
        $loader->load('rules.yml');
41 2
        $loader->load('form.yml');
42
        $this->loadDeviceListener($config, $loader);
43 2
44
        $this->registerStorage(Drivers::DRIVER_DOCTRINE_ORM, $config['persistence']['orm']['classes'], $container);
45 2
    }
46 1
47
    private function loadDeviceListener(array $config, Loader\YamlFileLoader $loader)
48 2
    {
49
        if ($config['device_listener']['enabled']) {
50
            $loader->load('device_listener.yml');
51
        }
52
    }
53
}
54