StorageConfigurationCompilerPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 14
rs 10
1
<?php
2
3
namespace DH\DoctrineAuditBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class StorageConfigurationCompilerPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container): void
12
    {
13
        if (!$container->hasDefinition('dh_doctrine_audit.configuration')) {
14
            return;
15
        }
16
17
        $config = $container->getParameter('dh_doctrine_audit.configuration');
18
        if (null === $config['storage_entity_manager']) {
19
            return;
20
        }
21
22
        $container
23
            ->getDefinition('dh_doctrine_audit.configuration')
24
            ->replaceArgument(4, new Reference($config['storage_entity_manager']))
25
        ;
26
    }
27
}
28