code: public function createService(ServiceLocatorInterface $serviceLocator)
      {
          $services = $serviceLocator->getServiceLocator();
          /* @var $options ModuleOptions */
          $options = $services->get(ModuleOptions::class);
  
          $identity = null;
          if ($services->has($options->getAuthenticationService())) {
              /* @var $authService \Zend\Authentication\AuthenticationServiceInterface */
              $authService = $services->get($options->getAuthenticationService());
  
              if ($authService->hasIdentity()) {
                  /* @var $identity \CmsUser\Mapping\UserInterface */
                  $identity = $authService->getIdentity();
              }
          }
  
          $validatorChain = new ValidatorChain();
  
          $validatorChain->attachByName('Callback', [
              'messages' => [
                  Callback::INVALID_VALUE => 'Your answer is wrong. '
                      . 'Please provide the correct answer',
              ],
              'callback' => function($value, $context = []) use ($identity)
              {
                  if (isset($context['answer'])) {
                      return strtolower($context['answer']) === $value;
                  } elseif ($identity) {
                      return $identity->getAnswer() === $value;
                  }
                  return false;
              },
          ], true);
  
          return $validatorChain;
      }
docs: {@inheritDoc}
  
  @return ValidatorInterface