YamlFixturesPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
1
<?php
2
namespace Khepin\YamlFixturesBundle\DependencyInjection\Compiler;
3
4
use Symfony\Component\DependencyInjection\Reference;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8
class YamlFixturesPass implements CompilerPassInterface
9
{
10
    public function process(ContainerBuilder $container)
11
    {
12
        if (!$container->has('problematic.acl_manager')) {
13
            return;
14
        }
15
        // If there was a call registered to set the acl manager, we can now
16
        // set it with the proper reference
17
        $definition = $container->getDefinition('khepin.yaml_loader');
18
        if ($definition->hasMethodCall('setAclManager')) {
19
            $definition->removeMethodCall('setAclManager');
20
            $definition->addMethodCall('setAclManager', array(new Reference('problematic.acl_manager')));
21
        }
22
    }
23
}
24