| 1 | <?php |
||
| 10 | class UserVO implements JsonSerializable |
||
| 11 | { |
||
| 12 | |||
| 13 | const PROPERTY_AVATAR = 'avatar'; |
||
| 14 | const PROPERTY_EMAIL = 'email'; |
||
| 15 | |||
| 16 | const ROLE_ADMIN = 'admin'; |
||
| 17 | const ROLE_USER = 'user'; |
||
| 18 | |||
| 19 | const AVATAR_1 = 'avatar1.png'; |
||
| 20 | const AVATAR_2 = 'avatar2.png'; |
||
| 21 | const AVATAR_3 = 'avatar3.png'; |
||
| 22 | const AVATAR_4 = 'avatar4.png'; |
||
| 23 | const AVATAR_5 = 'avatar5.png'; |
||
| 24 | |||
| 25 | const DEFAULT_AVATAR = self::AVATAR_5; |
||
| 26 | |||
| 27 | const ROLES = [ |
||
| 28 | self::ROLE_ADMIN, |
||
| 29 | self::ROLE_USER |
||
| 30 | ]; |
||
| 31 | |||
| 32 | const AVATARS = [ |
||
| 33 | self::AVATAR_1, |
||
| 34 | self::AVATAR_2, |
||
| 35 | self::AVATAR_3, |
||
| 36 | self::AVATAR_4, |
||
| 37 | self::AVATAR_5, |
||
| 38 | ]; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var int |
||
| 42 | */ |
||
| 43 | public $id = 0; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @var string |
||
| 47 | */ |
||
| 48 | public $username; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @var string |
||
| 52 | */ |
||
| 53 | public $password_hash; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @var string |
||
| 57 | */ |
||
| 58 | public $one_time_secret; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | public $password; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @var string |
||
| 67 | */ |
||
| 68 | public $email; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @var string[] |
||
| 72 | */ |
||
| 73 | public $roles = []; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | public $avatar; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return int |
||
| 82 | */ |
||
| 83 | 1 | public function getId() : int |
|
| 87 | |||
| 88 | /** |
||
| 89 | * @param string $role |
||
| 90 | * @return bool |
||
| 91 | */ |
||
| 92 | 1 | public function hasRole(string $role) : bool |
|
| 96 | |||
| 97 | /** |
||
| 98 | * @return string[] |
||
| 99 | */ |
||
| 100 | 1 | public function getRoles() : array |
|
| 104 | |||
| 105 | /** |
||
| 106 | * {@inheritdoc} |
||
| 107 | */ |
||
| 108 | 1 | public function getPassword() :string |
|
| 112 | |||
| 113 | /** |
||
| 114 | * {@inheritdoc} |
||
| 115 | */ |
||
| 116 | 1 | public function getSalt() |
|
| 120 | |||
| 121 | /** |
||
| 122 | * {@inheritdoc} |
||
| 123 | */ |
||
| 124 | 1 | public function getUsername() |
|
| 128 | |||
| 129 | /** |
||
| 130 | * @return array |
||
| 131 | */ |
||
| 132 | 1 | public function jsonSerialize() |
|
| 136 | |||
| 137 | /** |
||
| 138 | * @return array |
||
| 139 | */ |
||
| 140 | 1 | public function toArray() |
|
| 150 | } |
||
| 151 |