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

GpsLabGeoIP2Extension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 21
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
A getAlias() 0 4 1
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