WerkspotBingAdsApiExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
namespace Werkspot\BingAdsApiBundle\DependencyInjection;
3
4
use Symfony\Component\Config\FileLocator;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Loader;
7
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
9
/**
10
 * This is the class that loads and manages your bundle configuration
11
 *
12
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
13
 */
14
class WerkspotBingAdsApiExtension extends Extension
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function load(array $configs, ContainerBuilder $container)
20
    {
21
        $configuration = new Configuration();
22
        $config = $this->processConfiguration($configuration, $configs);
23
24
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
25
        $loader->load('services.yml');
26
27
        // Once the services definition are read, get your service and add a method call to setConfig()
28
        $sillyServiceDefintion = $container->getDefinition('werkspot.bing_ads.api.client');
29
        $sillyServiceDefintion->addMethodCall('setConfig', [$config]);
30
    }
31
}
32