CustomUserProviderCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 23
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 17 3
1
<?php
2
3
namespace Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * CustomUserProviderCompilerPass.
12
 */
13
final class CustomUserProviderCompilerPass implements CompilerPassInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        $customUserProvider = $container->getParameter('gesdinet_jwt_refresh_token.user_provider');
21
        if (!$customUserProvider) {
22
            return;
23
        }
24
        if (!$container->hasDefinition('gesdinet.jwtrefreshtoken.user_provider')) {
25
            return;
26
        }
27
28
        $definition = $container->getDefinition('gesdinet.jwtrefreshtoken.user_provider');
29
30
        $definition->addMethodCall(
31
            'setCustomUserProvider',
32
            array(new Reference($customUserProvider, ContainerInterface::NULL_ON_INVALID_REFERENCE, false))
0 ignored issues
show
Unused Code introduced by
The call to Reference::__construct() has too many arguments starting with false.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
33
        );
34
    }
35
}
36