/**
* {@inheritdoc}
*/
public function refreshUser(BaseUserInterface $user)
{
$class = get_class($user);
if (!$this->supportsClass($class)) {
throw new UnsupportedUserException(sprintf('Instance of "%s" are not supported.', $class));
}
$user = $this->userRepository->findUserWithSecurityById($user->getId());
if (!$user->getEnabled()) {
throw new DisabledException();
}
if ($user->getLocked()) {
throw new LockedException();
}
return $user;
}