Completed
Push — feature/EVO-6305_worker_authen... ( 11e94e )
by Bastian
08:06
created

SubnetUser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 61
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getUsername() 0 4 1
A setId() 0 4 1
A getId() 0 4 1
A getRoles() 0 4 1
1
<?php
2
/**
3
 * security SubnetUser entity
4
 * A basic user to allow login, query and find object based on anonymous authentication.
5
 */
6
7
namespace Graviton\SecurityBundle\Entities;
8
9
/**
10
 * Class SubnetUser
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 SubnetUser
17
{
18
    const DEFAULT_ID = 10;
19
    const ROLE_SUBNET = 'ROLE_GRAVITON_SUBNET_USER';
20
21
    /**
22
     * @var int
23
     */
24
    private $id;
25
26
    /**
27
     * @var string
28
     */
29
    private $username;
30
31
    /**
32
     * Constructor of the class.
33
     *
34
     * @param string $username Name of the user
35
     */
36
    public function __construct($username)
37
    {
38
        $this->username = $username;
39
        $this->setId(self::DEFAULT_ID);
40
    }
41
42
    /**
43
     * Returns the username used to authenticate the user.
44
     *
45
     * @return string The username
46
     */
47
    public function getUsername()
48
    {
49
        return $this->username;
50
    }
51
52
    /**
53
     * @param int $id id
54
     * @return void
55
     */
56
    public function setId($id)
57
    {
58
        $this->id = $id;
59
    }
60
61
    /**
62
     * @return int
63
     */
64
    public function getId()
65
    {
66
        return $this->id;
67
    }
68
69
    /**
70
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
71
     */
72
    public function getRoles()
73
    {
74
        return [self::ROLE_SUBNET];
75
    }
76
}
77