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

ClientUser::getClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
crap 2
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