StorageConfigurationCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
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