summaryrefslogtreecommitdiff
path: root/core/classes/authenticator/User.php
blob: b99fa7084730f4c39dc3fc755899b417a3437106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php


// namespace DevCoder\Authentication;

class User implements UserInterface
{

    // @var string
    private $userName;

    // @var string
    private $password;

    // @var array
    private $roles = [];

    // @var bool
    private $enabled = true;


    /** GETs
     * -------------------------------------------------------------------------
     */

    /** getUserName
     * @return null|string
     */
    public function getUsername(): ?string
    {
        return $this->userName;
    }

    /** getPassword
     * @return null|string
     */
    public function getPassword(): ?string
    {
        return $this->password;
    }

    /** getRoles
     * @return array
     */
    public function getRoles(): array
    {
        return $this->roles;
    }

    /** isEnabled
     * @return bool
     */
    public function isEnabled(): bool
    {
        return $this->enabled;
    }


    /** SETs
     * -------------------------------------------------------------------------
     */

    /** setUserName
     * @param string $userName
     * @return User
     */
    public function setUserName(string $userName): self
    {
        $this->userName = $userName;
        return $this;
    }

    /** setPassword
     * @param string $password
     * @return User
     */
    public function setPassword(string $password): self
    {
        $this->password = $password;
        return $this;
    }

    /** setRoles
     * @param array $roles
     * @return User
     */
    public function setRoles(array $roles): self
    {
        $this->roles = $roles;
        return $this;
    }

    /**
     * @param bool $enabled
     * @return User
     */
    public function setEnabled(bool $enabled): self
    {
        $this->enabled = $enabled;
        return $this;
    }
}