Passed
Branch develop (e34e62)
by Ludwig
07:24
created

CwdPowerDNSClientExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 15
rs 9.9332
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