Completed
Push — feature/evo-2472-whoami ( 843346...066c1c )
by
unknown
83:53 queued 67:03
created

AnonymousUser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 52
ccs 10
cts 12
cp 0.8333
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 4 1
A getId() 0 4 1
A __construct() 0 4 1
A getUsername() 0 4 1
A getRoles() 0 4 1
1
<?php
2
/**
3
 * security AnonymousUser entity
4
 * A basic user to allow loggin, query and find object based on anonymous authentication.
5
 */
6
7
namespace Graviton\SecurityBundle\Entities;
8
9
/**
10
 * Class AnonymousUser
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class AnonymousUser
17
{
18
    const DEFAULT_ID = 0;
19
20
    /**
21
     * @var int
22
     */
23
    private $id;
24
25
    /**
26
     * Constructor of the class.
27
     */
28
    public function __construct()
29 2
    {
30
        $this->setId(self::DEFAULT_ID);
31 2
    }
32 2
33
    /**
34
     * Returns the username used to authenticate the user.
35
     *
36
     * @return string The username
37
     */
38
    public function getUsername()
39 2
    {
40
        return 'anonymous';
41 2
    }
42
43
    /**
44
     * @param int $id id
45
     * @return void
46
     */
47 2
    public function setId($id)
48
    {
49 2
        $this->id = $id;
50 2
    }
51
52
    /**
53
     * @return int
54
     */
55 1
    public function getId()
56
    {
57 1
        return $this->id;
58
    }
59
60
    /**
61
     * @return array
62
     */
63
    public function getRoles()
64
    {
65
        return [];
66
    }
67
}
68