Completed
Push — master ( f9a038...cc9983 )
by Kamil
22:34
created

TestConfigurationSourceFactory::initializeSource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\ThemeBundle\Configuration\Test;
13
14
use Sylius\Bundle\ThemeBundle\Configuration\ConfigurationSourceFactoryInterface;
15
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Definition;
18
use Symfony\Component\DependencyInjection\Parameter;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
/**
22
 * @author Kamil Kokot <[email protected]>
23
 */
24
final class TestConfigurationSourceFactory implements ConfigurationSourceFactoryInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function buildConfiguration(ArrayNodeDefinition $node)
30
    {
31
        // no configuration
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function initializeSource(ContainerBuilder $container, array $config)
38
    {
39
        $container->setDefinition(
40
            'sylius.theme.test_theme_configuration_manager',
41
            new Definition(TestThemeConfigurationManager::class, [
42
                new Reference('sylius.theme.configuration.processor'),
43
                new Parameter('kernel.cache_dir'),
44
            ])
45
        );
46
47
        return new Definition(TestConfigurationProvider::class, [
48
            new Reference('sylius.theme.test_theme_configuration_manager'),
49
        ]);
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getName()
56
    {
57
        return 'test';
58
    }
59
}
60