CwdPowerDNSClientExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 15 1
1
<?php
2
/*
3
 * This file is part of the CwdPowerDNS Client
4
 *
5
 * (c) 2018 cwd.at GmbH <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Cwd\PowerDNSClient\DependencyInjection;
14
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Extension\Extension;
18
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
19
20
class CwdPowerDNSClientExtension extends Extension
21
{
22
    public function load(array $configs, ContainerBuilder $container)
23
    {
24
        $configuration = new Configuration();
25
        $config = $this->processConfiguration($configuration, $configs);
26
        $container->setParameter('cwd_power_dns_client.uri', $config['uri']);
27
        $container->setParameter('cwd_power_dns_client.api_key', $config['api_key']);
28
        $container->setParameter('cwd_power_dns_client.default_server', $config['default_server']);
29
30
        $container->setParameter('cwd_power_dns_client.clients', $config['hosts']);
31
32
        $loader = new YamlFileLoader(
33
            $container,
34
            new FileLocator(__DIR__.'/../Resources/config')
35
        );
36
        $loader->load('services.yaml');
37
    }
38
}
39