Create service

@param ServiceLocatorInterface $serviceLocator
@return mixed
517837
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \GkSmarty\ModuleOptions $options */
        $options = $serviceLocator->get('GkSmarty\ModuleOptions');
        $smartyManagerOptions = $options->getHelperManager();
        $smartyManagerConfigs = isset($smartyManagerOptions['configs']) ? $smartyManagerOptions['configs'] : array();

        $zfManager = $serviceLocator->get('ViewHelperManager');
        $smartyManager = new HelperPluginManager(new Config($smartyManagerOptions));
        $smartyManager->setServiceLocator($serviceLocator);
        $smartyManager->addPeeringServiceManager($zfManager);

        foreach ($smartyManagerConfigs as $configClass) {
            if (is_string($configClass) && class_exists($configClass)) {
                $config = new $configClass;

                if (!$config instanceof ConfigInterface) {
                    throw new Exception\RuntimeException(
                        sprintf(
                            'Service manager configuration classes must implement %s; received %s',
                            'Zend\ServiceManager\ConfigInterface',
                            is_object($configClass) ? get_class($configClass) : gettype($configClass)
                        )
                    );
                }

                $config->configureServiceManager($smartyManager);
            }
        }

        return $smartyManager;
    }
1264430
public function createService(ServiceManager\ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

        $config = (isset($config['yima_widgetator'])) ? $config['yima_widgetator'] : [];
        (isset($config['services'])) ? $config = $config['services'] : [];

        // ServiceLocator Will Injected into WidgetManager
        // because is instanceof serviceLocatorAwareInterface
        $smConfig      = new ServiceManager\Config($config);
        $widgetManager = new WidgetManager($smConfig);

        return $widgetManager;
    }
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;
    }
353376
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)
            );
        }

        return $plugins;
    }
465558
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof AbstractPluginManager) {
            $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator;
        }
        return $this($serviceLocator, Asset::class);
    }
833108
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $parser = $serviceLocator->get('ControllerNameParser');
        $logger = $serviceLocator->has('Logger') ? $serviceLocator->get('Logger') : null;

        return new ControllerResolver($serviceLocator, $parser, $logger);
    }
1250380
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Eye4web\Zf2Board\Options\ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get('Eye4web\Zf2Board\Options\ModuleOptions');

        $entityName = $moduleOptions->getTopicEntity();
        $object = new $entityName;

        $form = new CreateForm($object);

        return $form;
    }
1022944
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $className = $this->getClassName();
        $keyName   = $this->getKeyName();
        $config    = $serviceLocator->get('config');
        $options   = isset($config[$keyName]) ? $config[$keyName] : [];
        return new $className($options);
    }
748188
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $instance = new Workflow();
        $instance->setWorkflowFinder($serviceLocator->getServiceLocator()->get(\Prooph\Link\ProcessManager\Projection\Workflow\WorkflowFinder::class));
        return $instance;
    }
1140267
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $dump = new DumpCliContent();

        $dump->setFilesystem(new Filesystem());
        $dump->setTimestamp(time());

        $pipe = new Pipe(
            $dump
        );

        return $pipe;
    }
52291
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
        /* @var $plugins \Zend\ServiceManager\AbstractPluginManager */
        $plugins = new $pluginManagerClass();
        $plugins->setServiceLocator($serviceLocator);

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

        /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */
        $objectManagerAutoDetector = $appServiceLocator->get(ObjectManagerAutoDetectorInterface::class);

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

        /** @var DoctrineOrmModuleConfigInterface $doctrineOrmModuleConfig */
        $doctrineOrmModuleConfig = $appServiceLocator->get(DoctrineOrmModuleConfigInterface::class);

        return new OrmEntityLocator($objectManagerAutoDetector, $moduleOptions, $doctrineOrmModuleConfig);
    }
1078924
public function createService( ServiceLocatorInterface $serviceLocator )
    {
        // Configure the definitions
        $config     = $serviceLocator->get( 'Configuration' );
        $srvConfig  = isset( $config['modules']['Grid\Core']['settings'] )
                    ? (array) $config['modules']['Grid\Core']['settings']
                    : array();
        return new Definitions( $srvConfig );
    }
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;
    }
373395
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $pathManager = $serviceLocator->get('pathmanager');
        $path = $pathManager->get('cache', 'doctrine');
        $cache = new FilesystemCache($path);

        return $cache;
    }
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
        );
    }
237972
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Doctrine\Common\Persistence\ObjectManager $entityManager */
        $entityManager = $serviceLocator->get('Doctrine\ORM\EntityManager');
        $repository = $entityManager->getRepository('MamuzContentManager\Entity\Page');

        $queryMapper = new QueryMapper($repository);
        $queryService = new Query($queryMapper);

        return $queryService;
    }