Completed
Pull Request — 5.4 (#2640)
by Jeroen
06:59
created

InjectUntrackedTokenStorageCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
1
<?php
2
3
namespace Kunstmaan\AdminBundle\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 InjectUntrackedTokenStorageCompilerPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container): void
12
    {
13
        if (!$container->has('security.untracked_token_storage')) {
14
            return;
15
        }
16
17
        // NEXT_MAJOR: this compilerpass can be removed when we drop symfony <4.4 support + replace service argument in yaml config
18
        if ($container->has('kunstmaan_admin.logger.processor.user')) {
19
            $container->getDefinition('kunstmaan_admin.logger.processor.user')->setArgument(0, new Reference('security.untracked_token_storage'));
20
        }
21
    }
22
}
23