Create service

@param ServiceLocatorInterface $serviceLocator
@return \Facebook\FacebookSession
423421
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');
        $config = $config[self::CONFIG_KEY];

        if (is_null($config))
            throw new \RuntimeException(_('Config could not be found!'));

        FacebookSession::setDefaultApplication($config['appId'], $config['secret']);

        try {
            $helper = new FacebookCanvasLoginHelper();
            $session = $helper->getSession();

            $this->setAccessToken($session->getAccessToken());
        } catch (FacebookRequestException $ex) {
            StaticLogger::save($ex->__toString(), 'facebook.log');
        } catch (\Exception $ex) {
            StaticLogger::save($ex->__toString(), 'facebook.log');
        }

        return $session;
    }
1154900
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new LogCollector();

        /** @var LogRepositoryInterface $logRepository */
        $logRepository = $serviceLocator->get('LogRepository');
        $service->setLogRepository($logRepository);

        return $service;
    }
1235932
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Eye4web\Zf2Board\Options\ModuleOptions $options */
        $options = $serviceLocator->get('Eye4web\Zf2Board\Options\ModuleOptions');

        /** @var \Zend\Authentication\AuthenticationService $service */
        $service = $serviceLocator->get($options->getAuthenticationService());

        return $service;
    }
1307839
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var EntityManagerInterface $objectManager */
        $objectManager = $serviceLocator->get('Doctrine\ORM\EntityManager');

        /** @var ValidatorPluginManager $validatorPluginManager */
        $validatorPluginManager = $serviceLocator->get('ValidatorManager');

        return new DoctrineORMProvider($objectManager, $validatorPluginManager);
    }
690969
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var MonologOptions $options */
        $options = $serviceLocator->get('EnliteMonologOptions');
        return $this->createLogger($serviceLocator, $options);
    }
99488
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new PuppetClass();

        /** @var PuppetModule $moduleService */
        $moduleService = $serviceLocator->get('pmProxyPuppetModuleService');
        $service->setModuleService($moduleService);

        return $service;
    }
53246
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var \Zend\ServiceManager\ServiceLocatorInterface $viewHelperManager */
        $viewHelperManager = $serviceLocator->get('ViewHelperManager');
        /** @var \Zend\View\Helper\HeadLink $headLink */
        $headLink = $viewHelperManager->get('HeadLink');
        /** @var ServiceLocatorInterface $domainManager */
        $domainManager = $serviceLocator->get('MamuzBlog\DomainManager');
        /** @var \MamuzBlogFeed\Feed\Writer\BuilderInterface $builder */
        $builder = $domainManager->get('MamuzBlogFeed\Feed\WriterFactory');
        /** @var \MamuzBlogFeed\Options\ConfigProviderInterface $configProvider */
        $configProvider = $domainManager->get('MamuzBlogFeed\Options\ConfigProvider');

        return new HeadLinkAggregate($headLink, $builder, $configProvider);
    }
1219953
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var DataMapperManager $dataMapperManager */
        $dataMapperManager = $serviceLocator->get(DataMapperManager::class);

        $userMapper        = $dataMapperManager->getDataMapperForEntity(Entity\UserInterface::class);

        /** @var ThirdPartyMapperInterface $thirdPartyMapper */
        $thirdPartyMapper  = $dataMapperManager->getDataMapperForEntity(Entity\ThirdParty::class);

        /** @var TokenMapperInterface $accessTokenMapper */
        $accessTokenMapper = $dataMapperManager->getDataMapperForEntity(Entity\AccessToken::class);

        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);

        $grantType = new ThirdPartyGrantType($userMapper, $thirdPartyMapper, $accessTokenMapper, $moduleOptions);

        return $grantType;
    }
670307
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new NodeStatisticsProxy();

        /** @var MainCacheManager $mainCacheManager */
        $mainCacheManager = $serviceLocator->get('KmbCache\Service\MainCacheManager');
        $service->setCacheManager($mainCacheManager->getCacheManager('nodeStatistics'));

        return $service;
    }
343332
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var array                              $config
         * @var \RouteGuard\Service\InstanceLoader $loader
         */
        $config      = $serviceLocator->get('config');
        $guardConfig = isset($config['guards']) ? $config['guards'] : [];
        $loader      = $serviceLocator->get('RouteGuard\Service\InstanceLoader');
        $service     = new RouteGuard($guardConfig, $loader);

        return $service;
    }
657371
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsPluginManager */
        $moduleOptionsPluginManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class);

        $resolverByModuleContextMap = new ResolverByClassName($moduleOptionsPluginManager);

        return $resolverByModuleContextMap;
    }
148016
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');

        $service = new ModuleOptions($config['e4wzfcuserredirecturl']);
        return $service;
    }
1299556
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $workflowServiceManager = $serviceLocator->get(Manager::class);

        /** @var Module $module */
        $module = $serviceLocator->get(Module::class);
        $metadataReaderManager = $module->getMetadataReaderManager();

        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);

        $metadataReaderName = $moduleOptions->getMetadataReader();
        $metadataReaderOptions = $moduleOptions->getMetadataReaderOptions();
        $metadataReader = $metadataReaderManager->get($metadataReaderName, $metadataReaderOptions, false);

        $options = [
            'serviceManager' => $workflowServiceManager,
            'metadataReader' => $metadataReader
        ];

        return new ServiceTypeResolver($options);
    }
411472
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $caller = false;
        $appSm = method_exists($serviceLocator, 'getServiceLocator') ? call_user_func([$serviceLocator, 'getServiceLocator']) : null;
        if ($appSm && $appSm->has('Application')) {
            /** @var Application $app */
            $app = $appSm->get('Application');
            $callerEvent = new CallerEvent();
            $app->getEventManager()->trigger(CallerEvent::EVENT_RESOLVE_CALLER, $callerEvent);
            if ($callerEvent->getCaller()) {
                $caller = $callerEvent->getCaller();
            }
        }

        $w = new BasicWorkflow($caller);

        return $w;
    }
1120614
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */
        $moduleOptionsManager = $serviceLocator->get(ModuleOptionsPluginManagerInterface::class);

        /** @var DoctrineObjectManagerInterface $doctrineObjectManager */
        $doctrineObjectManager = $serviceLocator->get(DoctrineObjectManagerInterface::class);

        return new ObjectManagerAutoDetector($moduleOptionsManager, $doctrineObjectManager);
    }
578912
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var \Zend\View\HelperPluginManager $viewHelperManager */
        $viewHelperManager = $serviceLocator->get('ViewHelperManager');
        $optionsFilter = new FeedOptions($viewHelperManager->getRenderer());

        $config = $serviceLocator->get('Config')['MamuzBlogFeed'];
        return new ConfigProvider($config, $optionsFilter);
    }
1216068
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $this->getConfig($serviceLocator);

        if (!isset($config['cache'])) {
            return null;
        }

        $config = $config['cache'];
        /* @var $cache CacheProvider|Cache */
        $cache = null;
        $cacheFactory = $this->getCacheFactory($config);
        $cache = $cacheFactory->newInstance($config);

        if (isset($config['namespace'])) {
            $cache->setNamespace(trim($config['namespace']));
        }

        return $cache;
    }