AzineSocialBarExtension::load()   A
last analyzed

Complexity

Conditions 6
Paths 32

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 14
nc 32
nop 2
dl 0
loc 27
rs 9.2222
c 1
b 0
f 0
ccs 15
cts 15
cp 1
crap 6
1
<?php
2
3
namespace Azine\SocialBarBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration.
12
 *
13
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14
 */
15
class AzineSocialBarExtension extends Extension
16
{
17
    const PREFIX = 'azine_social_bar_';
18
    const FB_PROFILE = 'fb_profile_url';
19
    const XING_PROFILE = 'xing_profile_url';
20
    const LINKED_IN_PROFILE = 'linked_in_company_id';
21
    const GOOGLE_PLUS_PROFILE = 'google_plus_profile_url';
22
    const TWITTER_PROFILE = 'twitter_username';
23
24
    /**
25
     * {@inheritdoc}
26
     */
27 1
    public function load(array $configs, ContainerBuilder $container)
28
    {
29 1
        $configuration = new Configuration();
30 1
        $config = $this->processConfiguration($configuration, $configs);
31
32 1
        if (array_key_exists(self::FB_PROFILE, $config)) {
33 1
            $container->setParameter(self::PREFIX.self::FB_PROFILE, $config[self::FB_PROFILE]);
34
        }
35
36 1
        if (array_key_exists(self::XING_PROFILE, $config)) {
37 1
            $container->setParameter(self::PREFIX.self::XING_PROFILE, $config[self::XING_PROFILE]);
38
        }
39
40 1
        if (array_key_exists(self::LINKED_IN_PROFILE, $config)) {
41 1
            $container->setParameter(self::PREFIX.self::LINKED_IN_PROFILE, $config[self::LINKED_IN_PROFILE]);
42
        }
43
44 1
        if (array_key_exists(self::GOOGLE_PLUS_PROFILE, $config)) {
45 1
            $container->setParameter(self::PREFIX.self::GOOGLE_PLUS_PROFILE, $config[self::GOOGLE_PLUS_PROFILE]);
46
        }
47
48 1
        if (array_key_exists(self::TWITTER_PROFILE, $config)) {
49 1
            $container->setParameter(self::PREFIX.self::TWITTER_PROFILE, $config[self::TWITTER_PROFILE]);
50
        }
51
52 1
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
53 1
        $loader->load('services.yml');
54 1
    }
55
}
56