/**
  * Refreshes the user for the account interface.
  *
  * It is up to the implementation to decide if the user data should be
  * totally reloaded (e.g. from the database), or if the UserInterface
  * object can just be merged into some internal array of users / identity
  * map.
  *
  * @param UserInterface $user
  *
  * @return UserInterface
  *
  * @throws UnsupportedUserException if the account is not supported
  */
 public function refreshUser(UserInterface $user)
 {
     $class = get_class($user);
     if (!$this->supportsClass($class)) {
         $message = sprintf('Instances of "%s" are not supported.', $class);
         throw new UnsupportedUserException($message);
     }
     return $this->userRepository->find($user->getId());
 }
 public function getLoggedUser()
 {
     if (!$this->isUserLogged()) {
         return false;
     }
     if (!$this->loggedUser) {
         $userId = $this->container->get('request')->getSession()->get('user_id');
         $this->loggedUser = $this->userRepository->find($userId);
     }
     return $this->loggedUser;
 }