for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2016 Spomky-Labs
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace SpomkyLabs\TestRoleHierarchyBundle\Entity;
use Symfony\Component\Security\Core\User\UserInterface;
class User implements UserInterface
{
private $username;
private $password;
private $salt;
private $roles;
public function __construct($username, $password, $salt, array $roles)
$this->username = $username;
$this->password = $password;
$this->salt = $salt;
$this->roles = $roles;
}
public function getRoles()
return $this->roles;
public function getPassword()
return $this->password;
public function getSalt()
return $this->salt;
public function getUsername()
return $this->username;
public function eraseCredentials()
public function equals(UserInterface $user)
if (!$user instanceof self) {
return false;
if ($this->password !== $user->getPassword()) {
if ($this->getSalt() !== $user->getSalt()) {
if ($this->username !== $user->getUsername()) {
return true;