Completed
Push — master ( 798ee0...2329f6 )
by Lucas
08:18
created

AnonymousUser::getUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
     * @var string
27
     */
28
    private $username = 'anonymous';
29
30
    /**
31
     * Constructor of the class.
32
     */
33
    public function __construct()
34
    {
35
        $this->setId(self::DEFAULT_ID);
36
    }
37
38
    /**
39
     * Returns the username used to authenticate the user.
40
     *
41
     * @return string The username
42
     */
43
    public function getUsername()
44
    {
45
        return $this->username;
46
    }
47
48
    /**
49
     * @param int $id id
50
     * @return void
51
     */
52
    public function setId($id)
53
    {
54
        $this->id = $id;
55
    }
56
57
    /**
58
     * @return int
59
     */
60
    public function getId()
61
    {
62
        return $this->id;
63
    }
64
65
    /**
66
     * @return array
67
     */
68
    public function getRoles()
69
    {
70
        return [];
71
    }
72
}
73