Completed
Pull Request — develop (#353)
by
unknown
66:55 queued 17:28
created

AnonymousUser::__construct()   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
     * Constructor of the class.
27
     */
28
    public function __construct()
29
    {
30
        $this->setId(self::DEFAULT_ID);
31
    }
32
33
    /**
34
     * Returns the username used to authenticate the user.
35
     *
36
     * @return string The username
37
     */
38
    public function getUsername()
39
    {
40
        return 'anonymous';
41
    }
42
43
    /**
44
     * @param int $id id
45
     * @return void
46
     */
47
    public function setId($id)
48
    {
49
        $this->id = $id;
50
    }
51
52
    /**
53
     * @return int
54
     */
55
    public function getId()
56
    {
57
        return $this->id;
58
    }
59
60
    /**
61
     * @return array
62
     */
63
    public function getRoles()
64
    {
65
        return [];
66
    }
67
}
68