FacebookFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 21 1
A getPosition() 0 4 1
A getKey() 0 4 1
A addConfiguration() 0 3 1
1
<?php
2
3
namespace Otobank\Bundle\FacebookBundle\Security\Factory;
4
5
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
6
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\DefinitionDecorator;
9
10
class FacebookFactory implements SecurityFactoryInterface
11
{
12
    public function create(
13
        ContainerBuilder $container,
14
        $id,
15
        $config,
16
        $userProvider,
17
        $defaultEntryPoint
18
    ) {
19
        $providerId = 'security.authentication.provider.facebook.' . $id;
20
        $container
21
            ->setDefinition($providerId, new DefinitionDecorator('otobank_facebook.authentication_provider'))
22
            // ->replaceArgument(0, new Reference($userProvider))
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
        ;
24
        $listenerId = 'security.authentication.listener.facebook.' . $id;
25
        $listener = $container->setDefinition($listenerId, new DefinitionDecorator('otobank_facebook.authentication_listener'));
0 ignored issues
show
Unused Code introduced by
$listener is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
27
        return [
28
            $providerId,
29
            $listenerId,
30
            $defaultEntryPoint,
31
        ];
32
    }
33
34
    public function getPosition()
35
    {
36
        return 'pre_auth';
37
    }
38
39
    public function getKey()
40
    {
41
        return 'facebook';
42
    }
43
44
    public function addConfiguration(NodeDefinition $node)
45
    {
46
    }
47
}
48