/**
  * @param  ContainerInterface $container
  * @return TokenService
  */
 public function __invoke(ContainerInterface $container) : TokenService
 {
     /** @var ServerOptions $serverOptions */
     $serverOptions = $container->get(ServerOptions::class);
     /** @var AccessTokenRepositoryInterface $tokenRepository */
     $tokenRepository = $container->get(AccessTokenRepositoryInterface::class);
     /* @var ScopeService $scopeService */
     $scopeService = $container->get(ScopeService::class);
     $service = new TokenService($tokenRepository, $scopeService);
     $service->setTokenTTL($serverOptions->getAccessTokenTtl());
     return $service;
 }
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var \ZfrOAuth2Module\Server\Options\ModuleOptions $options */
     $options = $serviceLocator->get('ZfrOAuth2Module\\Server\\Options\\ModuleOptions');
     /* @var \Doctrine\Common\Persistence\ObjectManager $objectManager */
     $objectManager = $serviceLocator->get($options->getObjectManager());
     $tokenRepository = $objectManager->getRepository('ZfrOAuth2\\Server\\Entity\\AuthorizationCode');
     /* @var \ZfrOAuth2\Server\Service\ScopeService $scopeService */
     $scopeService = $serviceLocator->get('ZfrOAuth2\\Server\\Service\\ScopeService');
     $authorizationCodeService = new TokenService($objectManager, $tokenRepository, $scopeService);
     $authorizationCodeService->setTokenTTL($options->getAuthorizationCodeTtl());
     return $authorizationCodeService;
 }