Completed
Push — master ( 2d4f4c...04968a )
by Peter
04:27
created

GpsLabGeoIP2Extension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2017, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Bundle\GeoIP2Bundle\DependencyInjection;
11
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\Config\FileLocator;
14
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
15
use Symfony\Component\DependencyInjection\Loader;
16
17
class GpsLabGeoIP2Extension extends Extension
18
{
19
    public function load(array $configs, ContainerBuilder $container)
20
    {
21
        $config = $this->processConfiguration(new Configuration(), $configs);
22
23
        $container->setParameter('geoip2.cache', $config['cache']);
24
        $container->setParameter('geoip2.url', $config['url']);
25
26
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
27
        $loader->load('services.yml');
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getAlias()
34
    {
35
        return 'gpslab_geoip';
36
    }
37
}
38