for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BrainExe\Core\Authentication;
use JsonSerializable;
/**
* @api
*/
class UserVO implements JsonSerializable
{
const ROLE_ADMIN = 'admin';
const ROLE_USER = 'user';
const ROLES = [
self::ROLE_ADMIN,
self::ROLE_USER
];
* @var integer
public $id;
* @var string
public $username;
public $password_hash;
public $one_time_secret;
public $password;
public $email;
* @var string[]
public $roles = [];
public $avatar;
* @param string $role
* @return boolean
public function hasRole($role)
return in_array($role, $this->roles);
}
* @return string[]
public function getRoles()
return $this->roles;
* {@inheritdoc}
public function getPassword()
return $this->password_hash;
public function getSalt()
return $this->username;
public function getUsername()
* @return array
public function jsonSerialize()
return $this->toArray();
public function toArray()
return [
'userId' => $this->id,
'username' => $this->username,
'roles' => $this->roles,
'email' => $this->email,
'avatar' => $this->avatar,