Create Service Factory

@param ServiceLocatorInterface $viewHelperManager

@return BootstrapFlashMessenger
183371
public function createService(ServiceLocatorInterface $viewHelperManager)
    {
        $serviceManager          = $viewHelperManager->getServiceLocator();
        $controllerPluginManager = $serviceManager->get(
            'ControllerPluginManager'
        );

        $plugin = $controllerPluginManager->get('flashMessenger');

        $helper = new BootstrapFlashMessenger($plugin);

        return $helper;
    }
1223596
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var array $config */
        $config = $serviceLocator->get('Config')['eye4web_abac']['assertion_manager'];

        $pluginManager = new AssertionPluginManager(new Config($config));
        $pluginManager->setServiceLocator($serviceLocator);

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

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

        /** @var DoctrineObjectManagerInterface $objectManager */
        $objectManager = $appServiceLocator->get(DoctrineObjectManagerInterface::class);


        return new DoctrineObjectHydratorLocator($objectManagerAutoDetector, $objectManager);
    }
480034
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $serviceLocator \Zend\Mvc\Controller\ControllerManager */
        $sm = $serviceLocator->getServiceLocator();

        $pluginManager = $sm->get('HumusSupervisorModule\\ListenerManager');

        $controller = new ListenerController();
        $controller->setListenerManager($pluginManager);

        return $controller;
    }
298953
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 Index(
            $config,
            $serverUrl,
            $translator
        );
    }
1268310
public function createService(ServiceLocatorInterface $viewHelperManager)
    {
        $serviceLocator = $viewHelperManager->getServiceLocator();
        $config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array();
        if (isset($config['dojo'])) {
            $this->config($config['dojo']);
        }
        
        $application = $serviceLocator->get('application');
        $debug = $application->getRequest()->getQuery('debug'); 
        if ($debug !== null) {
            $this->setDebug($debug == 'true');
        }
        
        return $this;
    }
1156244
public function createService(ServiceLocatorInterface $helperManager)
    {
        /** @var ServiceLocatorInterface $serviceLocator */
        $serviceLocator = $helperManager->getServiceLocator();

        /** @var \Eye4web\Zf2Board\Service\AuthorService $authorService */
        $authorService = $serviceLocator->get('Eye4web\Zf2Board\Service\AuthorService');

        /** @var \Zend\Authentication\AuthenticationService $authenticationService */
        $authenticationService = $serviceLocator->get('Eye4web\Zf2Board\Service\AuthenticationService');

        if (!$authenticationService) {
            throw new \Exception('No authentication service has been provided');
        }

        $helper = new Boardhelper($authorService, $authenticationService);

        return $helper;
    }
1149351
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var array  $config */
        $config            = $serviceLocator->get('Config');
        $displayExceptions = array_key_exists('view_manager', $config)
            && array_key_exists('display_exceptions', $config['view_manager'])
            && $config['view_manager']['display_exceptions'];

        $listener = new SendApiProblemResponseListener();
        $listener->setDisplayExceptions($displayExceptions);

        if ($serviceLocator->has('Response')) {
            $response = $serviceLocator->get('Response');
            if ($response instanceof HttpResponse) {
                $listener->setApplicationResponse($response);
            }
        }

        if ($serviceLocator->has('Application')) {
            /** @var Application $app */
            $app = $serviceLocator->get('Application');
            $mvcEvent = $app->getMvcEvent();

            if ($mvcEvent instanceof MvcEvent) {
                $listener->setMvcEvent($mvcEvent);
            }
        }



        return $listener;
    }
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);
    }
1048529
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $options FormAnnotationBuilder */
        $options = $serviceLocator->get(FormAnnotationBuilder::class);

        $cache = $serviceLocator->has($options->getCache())
            ? $serviceLocator->get($options->getCache())
            : null;

        $builder = new AnnotationBuilder($cache);

        if ($serviceLocator->has('FormElementManager')) {
            $serviceLocator->get('FormElementManager')->injectFactory($builder);
        }

        foreach ($options->getAnnotations() as $annotation) {
            $builder->getAnnotationParser()->registerAnnotation($annotation);
        }

        $events = $builder->getEventManager();
        foreach ($options->getListeners() as $listener) {
            $listener = $serviceLocator->has($listener)
                ? $serviceLocator->get($listener)
                : new $listener();

            if (!$listener instanceof ListenerAggregateInterface) {
                throw new RuntimeException(sprintf(
                    'Invalid event listener (%s) provided',
                    get_class($listener)
                ));
            }

            $events->attach($listener);
        }

        if (null !== $options->getPreserveDefinedOrder()) {
            $builder->setPreserveDefinedOrder($options->getPreserveDefinedOrder());
        }

        return $builder;
    }
1001621
protected function buildServiceManager()
    {
        // ServiceManager creation
        $serviceManager = new ServiceManagerBuilder($this->getConfigManager()->getMergedConfig());
        $serviceManager->build($this->getAppParameters());
        $serviceManager->set('app', $this);

        return $serviceManager;
    }
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;
    }
736471
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $serviceLocator \Zend\ServiceManager\AbstractPluginManager */
        $parentLocator           = $serviceLocator->getServiceLocator();
        /* @var $inspectionsRepository InspectionRepositoryInterface */
        $inspectionsRepository   = $parentLocator->get(InspectionRepositoryInterface::class);
        /* @var $inspectionsListRenderer ListInspectionRenderer */
        $inspectionsListRenderer = $parentLocator->get(DetailInspectionRenderer::class);

        return new InspectionController($inspectionsRepository, $inspectionsListRenderer);
    }
483552
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $snippetHelper = new SnippetHelper();

        // Get the top level service locator
        $serviceManager = $serviceLocator;
        if ($serviceManager instanceof HelperPluginManager) {
            $serviceManager = $serviceManager->getServiceLocator();
        }

        if (!$serviceManager->has('Config')) {
            return $snippetHelper;
        }


        $config = $serviceManager->get('Config');

        $snippetsConfig = isset($config[$this->configKey]) ? $config[$this->configKey] : [];

        if (!isset($snippetsConfig['snippets'])) {
            return $snippetHelper;
        }

        $snippets = $snippetsConfig['snippets'];


        if (!is_array($snippets)) {
            return $snippetHelper;
        }

        return $this->configureSnippetHelper($snippetHelper, $config, $snippetsConfig);

    }
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;
    }
881231
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $parentlocator = $serviceLocator->getServiceLocator();

        if (! isset ($parentlocator->get('Config')['maintenance']['flag_file'])) {
            $defaultModuleConfig = require __DIR__ . '/../../config/maintenance.config.global.php.dist';
            $flagFilePath        = $defaultModuleConfig['maintenance']['flag_file'];
        } else {
            $flagFilePath = $parentlocator->get('Config')['maintenance']['flag_file'];
        }

        return new MaintenanceModeController($flagFilePath);
    }
439696
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');
        $config = new GuardLoaderConfig($config['guard']['instance_loader']);
        $loader = new InstanceLoader($config);

        return $loader;
    }