/**
  * @param  AdapterChainEvent $e
  * @return bool
  */
 public function authenticate(AdapterChainEvent $e)
 {
     if ($e->getIdentity()) {
         $userObject = $this->userMapper->findById($e->getIdentity());
         $registrationRecord = $this->userRegistrationMapper->findByUser($userObject);
         if (!$registrationRecord || !$registrationRecord->isResponded()) {
             $e->setCode(AuthenticationResult::FAILURE)->setMessages(array('Email Address not verified yet'));
             return false;
         }
         return true;
     }
     return false;
 }
 /**
  * gets user from user_id
  * it only queries one time for a user
  * @param int $id (user_id)
  *
  * @return UserMapperInterface
  */
 protected function getUser($id)
 {
     if (!isset($this->retrievedUsers[$id])) {
         $user = $this->userMapper->findById($id);
         $this->retrievedUsers[$id] = $user;
     }
     return $this->retrievedUsers[$id];
 }
 /**
  * @param $userId
  * @return ZfcUserMapperInterface
  */
 public function getUser($userId)
 {
     return $this->zfcUserMapper->findById($userId);
 }
 public function __invoke($userId)
 {
     $user = $this->userMapper->findById($userId);
     return $user->getDisplayName();
 }