Completed
Push — master ( 145693...9a5594 )
by Peter
06:17
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
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\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
class Configuration implements ConfigurationInterface
16
{
17
    /**
18
     * Config tree builder.
19
     *
20
     * Example config:
21
     *
22
     * gpslab_geoip:
23
     *     cache: '%kernel.cache_dir%GeoLite2-Country.mmdb'
24
     *     url: 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz'
25
     *
26
     * @return TreeBuilder
27
     */
28
    public function getConfigTreeBuilder()
29
    {
30
        return (new TreeBuilder())
31
            ->root('gps_lab_geoip2')
32
            ->addDefaultsIfNotSet()
33
            ->children()
34
                ->scalarNode('cache')->end()
35
                ->scalarNode('url')->end()
36
            ->end();
37
    }
38
}
39