SumoCodersFrameworkUserExtension::prepend()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace SumoCoders\FrameworkUserBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
use Symfony\Component\DependencyInjection\Loader;
10
use Symfony\Component\Yaml\Parser;
11
12
/**
13
 * This is the class that loads and manages your bundle configuration
14
 *
15
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
16
 */
17
class SumoCodersFrameworkUserExtension extends Extension implements PrependExtensionInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function load(array $configs, ContainerBuilder $container)
23
    {
24
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
25
        $loader->load('services.yml');
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function prepend(ContainerBuilder $container)
32
    {
33
        $yamlParser = new Parser();
34
        $config = $yamlParser->parse(file_get_contents(__DIR__ . '/../Resources/config/config.yml'));
35
        $container->prependExtensionConfig('fos_user', $config['fos_user']);
36
    }
37
}
38