@inheritdoc

@param ServiceLocatorInterface $serviceLocator

@return ResolverByModuleContextMap
@throws \Nnx\EntryNameResolver\Exception\RuntimeException

@throws \Zend\ServiceManager\Exception\ServiceNotFoundException
7914
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

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


        $creationOptions = $this->getCreationOptions();
        $options = is_array($creationOptions) ? $creationOptions : [];

        $contextMap = array_key_exists('contextMap', $options) ? $options['contextMap'] : [];

        $className = array_key_exists('className', $options) ? (string)$options['className'] : static::$defaultTargetClassName;

        $r = new ReflectionClass($className);
        $resolverByModuleContextMap = $r->newInstance($moduleOptionsPluginManager);

        if (!$resolverByModuleContextMap instanceof static::$defaultTargetClassName) {
            $errMsg = sprintf('ResolverByModuleContextMap not implements: %s', static::$defaultTargetClassName);
            throw new Exception\RuntimeException($errMsg);
        }

        $resolverByModuleContextMap->setContextMap($contextMap);

        return $resolverByModuleContextMap;
    }
788593
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \GkSmarty\ModuleOptions $options */
        $options = $serviceLocator->get('GkSmarty\ModuleOptions');

        /** @var \Zend\View\Resolver\TemplateMapResolver */
        $templateMap = $serviceLocator->get('ViewTemplateMapResolver');

        // build map of template files with registered extension
        $map = array();
        foreach($templateMap as $name => $path) {
            if($options->getSuffix() == pathinfo($path, PATHINFO_EXTENSION)) {
                $map[$name] = $path;
            }
        }

        return new TemplateMapResolver($map);
    }
457589
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var array $config
         */
        $config = $serviceLocator->get('config');

        /**
         * @var \Zend\View\HelperPluginManager $serverUrl
         */
        $serverUrl = $serviceLocator->get('ViewHelperManager');

        /**
         * @var \Zend\Mvc\I18n\Translator $translator
         */
        $translator = $serviceLocator->get('translator');

        return new Search(
            $config,
            $serverUrl,
            $translator
        );
    }
1078873
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
    {
        $this->serviceLocator = $serviceLocator;
        $this->callback = null;

        return $this;
    }
730572
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Zend\ServiceManager\AbstractPluginManager $serviceLocator */
        $options = $this->getCreationOptions();
        if (isset($options['assertion']) && is_string($options['assertion'])) {
            $serviceManager = $serviceLocator->getServiceLocator();
            if ($serviceManager->has($options['assertion'])) {
                $options['assertion'] = $serviceManager->get($options['assertion']);
            }
        }

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

        $service = new ModuleOptions($config['e4wzfcuserredirecturl']);
        return $service;
    }
750123
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \GkSmarty\ModuleOptions $options */
        $options = $serviceLocator->get('GkSmarty\ModuleOptions');

        /** @var \Zend\View\Resolver\TemplatePathStack */
        $templatePathStack = $serviceLocator->create('ViewTemplatePathStack');
        $templatePathStack->setDefaultSuffix($options->getSuffix());

        return $templatePathStack;
    }
274073
public function setServiceLocator( ServiceLocatorInterface $serviceLocator )
    {
        if ( null === $this->serviceLocator )
        {
            $this->setExactServiceLocator( $serviceLocator );
        }

        return $this;
    }
654670
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptions $options */
        $options = $serviceLocator->get('KmbPuppetDb\Options\ModuleOptions');

        $className = 'KmbPuppetDb\Query\Nodes' . strtoupper($options->getApiVersion()) . 'NamesQueryBuilder';
        if (!class_exists($className)) {
            throw new InvalidArgumentException('Invalid API version : ' . $options->getApiVersion());
        }

        return new $className();
    }
1230628
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        $objectConfig = [];
        if (isset($config['matryoshka']) && isset($config['matryoshka']['object_manager'])) {
            $objectConfig = $config['matryoshka']['object_manager'];
        }
        return new ObjectManager(new Config($objectConfig));
    }
70910
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $plugins = parent::createService($serviceLocator);
        $plugins->addPeeringServiceManager($serviceLocator);
        $plugins->setRetrieveFromPeeringManagerFirst(true);

        return $plugins;
    }
1250936
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $plugin = new CustomGroups();
        $config = $serviceLocator->getServiceLocator()->get('Config');
        if (isset($config['custom_groups'])) {
            $plugin->setConfig($config['custom_groups']);
        }
        return $plugin;
    }
112312
public function createService(ServiceLocatorInterface $serviceLocator)
    {

        $pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
        $plugins = new $pluginManagerClass;
        $plugins->setServiceLocator($serviceLocator);
        $configuration    = $serviceLocator->get('Config');

        if (isset($configuration['di']) && $serviceLocator->has('Di')) {
            $di = $serviceLocator->get('Di');
            $plugins->addAbstractFactory(
                new DiAbstractServiceFactory($di, DiAbstractServiceFactory::USE_SL_BEFORE_DI)
            );
        }

        foreach ($this->defaultHelperMapClasses as $configClass) {
            if (is_string($configClass) && class_exists($configClass)) {
                $config = new $configClass;
            }

            if (!$config instanceof ConfigInterface) {
                throw new Exception\RuntimeException(sprintf(
                    'Invalid service manager configuration class provided; received "%s", expected class implementing %s',
                    $configClass,
                    'Zend\ServiceManager\ConfigInterface'
                ));
            }

            $config->configureServiceManager($plugins);
        }

        // Configure URL view helper with router
        $plugins->setFactory('url', function($sm) use($serviceLocator) {
            $helper = new ViewHelper\Url;
            $helper->setRouter($serviceLocator->get('Router'));

            $match = $serviceLocator->get('application')
                ->getMvcEvent()
                ->getRouteMatch();

            if ($match instanceof RouteMatch) {

                $helper->setRouteMatch($match);
            }

            return $helper;
        });

        $plugins->setFactory('basepath', function($sm) use($serviceLocator) {
            $config = $serviceLocator->get('Config');
            $config = $config['view_manager'];
            $basePathHelper = new ViewHelper\BasePath;
            if (isset($config['base_path'])) {
                $basePath = $config['base_path'];
            } else {
                $basePath = $serviceLocator->get('Request')->getBasePath();
            }
            $basePathHelper->setBasePath($basePath);
            return $basePathHelper;
        });

        /**
         * Configure doctype view helper with doctype from configuration, if available.
         *
         * Other view helpers depend on this to decide which spec to generate their tags
         * based on. This is why it must be set early instead of later in the layout phtml.
         */
        $plugins->setFactory('doctype', function($sm) use($serviceLocator) {
            $config = $serviceLocator->get('Config');
            $config = $config['view_manager'];
            $doctypeHelper = new ViewHelper\Doctype;
            if (isset($config['doctype'])) {
                $doctypeHelper->setDoctype($config['doctype']);
            }
            return $doctypeHelper;
        });

        return $plugins;
    }
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);
    }
72672
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $resource = new MessageHandler();

        $resource->setFinder($serviceLocator->getServiceLocator()->get(MessageHandlerFinder::class));

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


        /** @var EntryToObjectsService $entryToObjectsService */
        $entryToObjectsService = $appServiceLocator->get(EntryToObjectsService::class);

        $options = [
            'entryToObjectsService' => $entryToObjectsService
        ];

        return new EntryToObjectsControllerPlugin($options);
    }
88769
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $serviceManager = $serviceLocator->getServiceLocator();
        $helper = new Widget();
        $helper->setServiceLocator($serviceManager);
        $config = $serviceManager->get('Config');
        if (isset($config['view_helper_config']['widget'])) {
            $helper->setConfig($config['view_helper_config']['widget']);
        }

        return $helper;
    }