FacebookUser   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 54
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoles() 0 4 1
A getPassword() 0 4 1
A getSalt() 0 4 1
A getUsername() 0 4 1
A eraseCredentials() 0 4 1
A isEqualTo() 0 8 3
1
<?php
2
3
namespace Otobank\Bundle\FacebookBundle\Security\User;
4
5
use Facebook\GraphNodes\GraphUser;
6
use Symfony\Component\Security\Core\User\EquatableInterface;
7
use Symfony\Component\Security\Core\User\UserInterface;
8
9
class FacebookUser extends GraphUser implements UserInterface, EquatableInterface
10
{
11
    /**
12
     * {@inheritDoc}
13
     */
14
    public function getRoles()
15
    {
16
        return ['ROLE_FACEBOOK_USER'];
17
    }
18
19
    /**
20
     * {@inheritDoc}
21
     */
22
    public function getPassword()
23
    {
24
        return '';
25
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function getSalt()
31
    {
32
        return null;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function getUsername()
39
    {
40
        return $this->getId();
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function eraseCredentials()
47
    {
48
        // $this->items = [];
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     */
54
    public function isEqualTo(UserInterface $user)
55
    {
56
        if ($user instanceof FacebookUser && $user->getId() === $this->getId()) {
57
            return true;
58
        }
59
60
        return false;
61
    }
62
}
63