Completed
Push — master ( 1cf9f7...7f0cbd )
by Rafał
08:07
created

SWPGeoIPExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Publisher Geo IP 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\GeoIPBundle\DependencyInjection;
18
19
use Symfony\Component\Config\FileLocator;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Extension\Extension;
22
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
23
24
class SWPGeoIPExtension extends Extension
25
{
26
    public function load(array $configs, ContainerBuilder $container): void
27
    {
28
        $configuration = new Configuration();
29
        $config = $this->processConfiguration($configuration, $configs);
30
31
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32
        $loader->load('services.yaml');
33
34
        $container->setParameter('swp.geo_ip.database_url', $config['database_url']);
35
        $container->setParameter('swp.geo_ip.database_path', $config['database_path']);
36
    }
37
}
38