1 | <?php |
||
10 | class UserVO implements JsonSerializable |
||
11 | { |
||
12 | |||
13 | const ROLE_ADMIN = 'admin'; |
||
14 | const ROLE_USER = 'user'; |
||
15 | |||
16 | const ROLES = [ |
||
17 | self::ROLE_ADMIN, |
||
18 | self::ROLE_USER |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * @var integer |
||
23 | */ |
||
24 | public $id; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $username; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | public $password_hash; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | public $one_time_secret; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | public $password; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | public $email; |
||
50 | |||
51 | /** |
||
52 | * @var string[] |
||
53 | */ |
||
54 | public $roles = []; |
||
55 | |||
56 | /** |
||
57 | * @var string |
||
58 | */ |
||
59 | public $avatar; |
||
60 | |||
61 | /** |
||
62 | * @param string $role |
||
63 | * @return boolean |
||
64 | */ |
||
65 | 1 | public function hasRole($role) |
|
69 | |||
70 | /** |
||
71 | * @return string[] |
||
72 | */ |
||
73 | 1 | public function getRoles() |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 1 | public function getPassword() |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 1 | public function getSalt() |
|
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | 1 | public function getUsername() |
|
101 | |||
102 | /** |
||
103 | * @return array |
||
104 | */ |
||
105 | 1 | public function jsonSerialize() |
|
109 | |||
110 | /** |
||
111 | * @return array |
||
112 | */ |
||
113 | 1 | public function toArray() |
|
123 | } |
||
124 |