AdobeCampaignClientExtension::loadClient()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
rs 9.9332
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace LaFourchette\AdobeCampaignClientBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Definition;
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
use Symfony\Component\DependencyInjection\Loader;
10
11
/**
12
 * This is the class that loads and manages your bundle configuration
13
 *
14
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
15
 */
16
class AdobeCampaignClientExtension extends Extension
17
{
18
    /**
19
     * {@inheritDoc}
20
     */
21 1
    public function load(array $configs, ContainerBuilder $container)
22
    {
23 1
        $configuration = new Configuration();
24 1
        $config = $this->processConfiguration($configuration, $configs);
25 1
        $container->setParameter('adobe_campaign_client.configuration', $config);
26
27 1
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
28 1
        $loader->load('services.xml');
29
30
        // Load client services from configuration
31 1
        foreach ($config['schemas'] as $node) {
32 1
            $this->loadClient($container, $node);
33 1
        }
34 1
    }
35
36
    /**
37
     * @param ContainerBuilder $container
38
     * @param array            $node
39
     */
40 1
    protected function loadClient(ContainerBuilder $container, $node)
41
    {
42 1
        $definitionClient = new Definition('LaFourchette\AdobeCampaignClientBundle\Client\Client', array(
43 1
            $node['schema']
44 1
        ));
45 1
        $definitionClient->setFactoryService('adobe_campaign_client.creator.client');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Depend...on::setFactoryService() has been deprecated with message: since version 2.6, to be removed in 3.0.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
46 1
        $definitionClient->setFactoryMethod('create');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Depend...ion::setFactoryMethod() has been deprecated with message: since version 2.6, to be removed in 3.0.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
47
48 1
        $container->setDefinition('adobe_campaign_client.client.' . $node['name'], $definitionClient);
49 1
    }
50
}
51