Completed
Push — master ( 5ec4be...3f1e8c )
by Paweł
08:46
created

SWPRedirectRouteExtension::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Publisher Redirect Route Bundle.
7
 *
8
 * Copyright 2019 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2019 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\RedirectRouteBundle\DependencyInjection;
18
19
use SWP\Bundle\StorageBundle\DependencyInjection\Extension\Extension;
20
use SWP\Bundle\StorageBundle\Drivers;
21
use Symfony\Component\Config\FileLocator;
22
use Symfony\Component\DependencyInjection\ContainerBuilder;
23
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
24
25 View Code Duplication
class SWPRedirectRouteExtension extends Extension
26
{
27
    public function load(array $configs, ContainerBuilder $container): void
28
    {
29
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
30
        $loader->load('services.yaml');
31
32
        $config = $this->processConfiguration(new Configuration(), $configs);
33
34
        if ($config['persistence']['orm']['enabled']) {
35
            $this->registerStorage(Drivers::DRIVER_DOCTRINE_ORM, $config['persistence']['orm']['classes'], $container);
36
        }
37
    }
38
}
39