for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File part of the Redmine User Provider bundle
*
* @category SymfonyBundle
* @package GMaissa.RedmineUserProviderBundle
* @author Guillaume Maïssa <[email protected]>
* @copyright 2017 Guillaume Maïssa
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
*/
namespace GMaissa\RedmineUserProviderBundle\Factory;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserInterface;
* User factory class
class UserFactory implements UserFactoryInterface
{
* @var string
protected $userClass;
* {@inheritdoc}
public function setUserClass(string $class)
$this->userClass = $class;
}
public function build(array $data = null): UserInterface
return new $this->userClass($data);
public function getUserClass(): string
return $this->userClass;
public function refreshUser(UserInterface $user): UserInterface
if (!$user instanceof $this->userClass) {
throw new UnsupportedUserException(
sprintf('Instances of "%s" are not supported.', get_class($user))
);
return $user;