1 | <?php |
||
11 | class UserVO implements JsonSerializable |
||
12 | { |
||
13 | |||
14 | const PROPERTY_AVATAR = 'avatar'; |
||
15 | const PROPERTY_EMAIL = 'email'; |
||
16 | |||
17 | const ROLE_ADMIN = 'admin'; |
||
18 | const ROLE_USER = 'user'; |
||
19 | |||
20 | const AVATAR_1 = 'avatar1.png'; |
||
21 | const AVATAR_2 = 'avatar2.png'; |
||
22 | const AVATAR_3 = 'avatar3.png'; |
||
23 | const AVATAR_4 = 'avatar4.png'; |
||
24 | const AVATAR_5 = 'avatar5.png'; |
||
25 | |||
26 | const DEFAULT_AVATAR = self::AVATAR_5; |
||
27 | |||
28 | const ROLES = [ |
||
29 | self::ROLE_ADMIN, |
||
30 | self::ROLE_USER |
||
31 | ]; |
||
32 | |||
33 | const ROLE_MAP = [ |
||
34 | self::ROLE_USER => [self::ROLE_ADMIN] |
||
35 | ]; |
||
36 | |||
37 | const AVATARS = [ |
||
38 | self::AVATAR_1, |
||
39 | self::AVATAR_2, |
||
40 | self::AVATAR_3, |
||
41 | self::AVATAR_4, |
||
42 | self::AVATAR_5, |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | public $id = 0; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | public $username; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | public $password_hash; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | public $one_time_secret; |
||
64 | |||
65 | /** |
||
66 | * @todo needed in VO? |
||
67 | * @var string |
||
68 | */ |
||
69 | public $password; |
||
70 | |||
71 | /** |
||
72 | * @var string |
||
73 | */ |
||
74 | public $email; |
||
75 | |||
76 | /** |
||
77 | * @var string[] |
||
78 | */ |
||
79 | public $roles = []; |
||
80 | |||
81 | /** |
||
82 | * @var string |
||
83 | */ |
||
84 | public $avatar; |
||
85 | |||
86 | /** |
||
87 | * @return int |
||
88 | */ |
||
89 | 1 | public function getId() : int |
|
93 | |||
94 | /** |
||
95 | * @param string $role |
||
96 | * @return bool |
||
97 | */ |
||
98 | 3 | public function hasRole(string $role) : bool |
|
114 | |||
115 | /** |
||
116 | * @return string[] |
||
117 | */ |
||
118 | 1 | public function getRoles() : array |
|
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | 1 | public function getPassword() :string |
|
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | 1 | public function getSalt() |
|
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 1 | public function getUsername() |
|
146 | |||
147 | /** |
||
148 | * @return array |
||
149 | */ |
||
150 | 1 | public function jsonSerialize() |
|
154 | |||
155 | /** |
||
156 | * @return array |
||
157 | */ |
||
158 | 1 | public function toArray() |
|
168 | } |
||
169 |
This check looks
TODO
comments that have been left in the code.``TODO``s show that something is left unfinished and should be attended to.