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

InjectUntrackedTokenStorageCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 3
nc 3
nop 1
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