Completed
Pull Request — master (#170)
by Simonas
04:25
created

SettingsManagerPass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
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 ONGR\SettingsBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
class SettingsManagerPass implements CompilerPassInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function process(ContainerBuilder $container)
25
    {
26
        $repo = $container->getParameter('ongr_settings.repo');
27
        $filterManager = new Definition('ONGR\FilterManagerBundle\Search\FilterManager', [
28
            new Reference('ongr_settings.filter_container'),
29
            new Reference($repo)
30
        ]);
31
32
        $container->setDefinition('ongr_filter_manager.settings', $filterManager);
33
34
        $settingsManager = new Definition('ONGR\SettingsBundle\Service\SettingsManager', [
35
            new Reference($repo),
36
            new Reference('event_dispatcher')
37
        ]);
38
        $settingsManager->addMethodCall('setActiveProfilesSettingName', ['%ongr_settings.active_profiles%']);
39
        
40
        $container->setDefinition('ongr_settings.settings_manager', $settingsManager);
41
    }
42
}