Failed Conditions
Push — issue#767 ( a787f5...dafcb3 )
by Guilherme
05:02
created

ClientUser   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 20%

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
ccs 3
cts 15
cp 0.2
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A eraseCredentials() 0 3 1
A getUsername() 0 3 1
A getPassword() 0 3 1
A getRoles() 0 3 1
A getClient() 0 3 1
A getSalt() 0 3 1
1
<?php
2
3
namespace LoginCidadao\OAuthBundle\Model;
4
5
use Symfony\Component\Security\Core\User\UserInterface;
6
7
class ClientUser implements UserInterface
8
{
9
10
    /**
11
     * @var ClientInterface
12
     */
13
    protected $client;
14
15 1
    public function __construct(ClientInterface $client)
16
    {
17 1
        $this->client = $client;
18 1
    }
19
20
    public function eraseCredentials()
21
    {
22
        return;
23
    }
24
25
    public function getPassword()
26
    {
27
        return null;
28
    }
29
30
    public function getRoles()
31
    {
32
        return array('ROLE_API_CLIENT');
33
    }
34
35
    public function getSalt()
36
    {
37
        return null;
38
    }
39
40
    public function getUsername()
41
    {
42
        return sprintf("client:%s", $this->getClient()->getPublicId());
43
    }
44
45
    /**
46
     * @return ClientInterface
47
     */
48
    public function getClient()
49
    {
50
        return $this->client;
51
    }
52
53
}
54