Create service

@param  ServiceLocatorInterface $serviceLocator

@return \RouteGuard\Service\RouteGuard
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;
    }
757218
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $manager = parent::createService($serviceLocator);
        if ($serviceLocator instanceof ServiceManager) {
            $manager->addPeeringServiceManager($serviceLocator);
        }

        return  $manager;
    }
245575
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        return new RouterCacheOptions(
                isset($config['router'])
                    ? $config['router']
                    : null
            );
    }
249250
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config             = $serviceLocator->get('config');
        $sessionOptions     = $serviceLocator->get(SessionOptions::class);
        $sessionConfig      = $config['uthando_session_manager']['config_options'] ?? [];
        /** @var SessionConfig $sessionConfigClass */
        $sessionConfigClass = $sessionOptions->getSessionConfigClass();
        $sessionConfigClass = new $sessionConfigClass() ;

        $sessionConfigClass->setOptions($sessionConfig);

        return $sessionConfigClass;
    }
755880
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = new Configuration();

        $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy());

        return new AccessInterceptorScopeLocalizerFactory($config);
    }
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);
    }
155752
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return new AnnotationRouter(
            $serviceLocator->get('TjoAnnotationRouter\Options\Config'),
            $serviceLocator->get('TjoAnnotationRouter\Parser\ControllerParser'),
            new Merger(),
            $serviceLocator->get('ControllerLoader')
        );
    }
439696
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');
        $config = new GuardLoaderConfig($config['guard']['instance_loader']);
        $loader = new InstanceLoader($config);

        return $loader;
    }
833108
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $parser = $serviceLocator->get('ControllerNameParser');
        $logger = $serviceLocator->has('Logger') ? $serviceLocator->get('Logger') : null;

        return new ControllerResolver($serviceLocator, $parser, $logger);
    }
1132209
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var ServiceLocatorInterface $domainManager */
        $domainManager = $serviceLocator->get('MamuzBlog\DomainManager');
        /** @var \MamuzBlogFeed\Options\ConfigProviderInterface $configProvider */
        $configProvider = $domainManager->get('MamuzBlogFeed\Options\ConfigProvider');

        $queryFilter = new Query($configProvider);

        return new QueryFilterAggregate($queryFilter);
    }
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);
    }
771032
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }



        $serializerManager = $appServiceLocator->get('SerializerAdapterManager');
        $moduleOptions = $appServiceLocator->get(ModuleOptions::class);
        $workflowService  = $appServiceLocator->get(Workflow::class);

        return new EntryToObjectsService(
            [
                'serializerManager' => $serializerManager,
                'moduleOptions' => $moduleOptions,
                'workflowService' => $workflowService
            ]
        );
    }
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;
    }
411769
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new Group();

        /** @var Environment $environmentService */
        $environmentService = $serviceLocator->get('KmbPuppet\Service\Environment');
        $service->setEnvironmentService($environmentService);

        return $service;
    }
461444
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $routeCollection = new RouteCollection();
        $requestContext  = $serviceLocator->get('RouterRequestContext');
        $routerOptions   = array();

        $logger = $serviceLocator->has('logger') ? $serviceLocator->get('Logger') : null;

        $router = new Router($requestContext, $routeCollection, $routerOptions, $logger);

        // @todo - consider making a base router class, and then have a ModuleRouterFactory to pull module routes
        // @todo - find a way to set routes on this after we instantiate this factory

        // @todo - let you add new routes on demand and call $router->setRouteCollection()
        return $router;
    }
275175
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        $transportClass = 'Zend\\Mail\\Transport\\Sendmail';
        if(isset($config['contact']['transport_class']) && class_exists($config['contact']['transport_class'], true)){
            $transportClass = $config['contact']['transport_class'];
        }
        return new $transportClass($config);
    }
1019435
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($this->container !== null) {
            return $this->container;
        }

        $builder = new ContainerBuilder();
        $config = $this->getConfig($serviceLocator);
        $configFile = $this->getDefinitionsFilePath($config);
        $builder->addDefinitions($configFile);

        $useAnnotations = $this->shouldUseAnnotations($config);
        $builder->useAnnotations($useAnnotations);

        $acclimator = new ContainerAcclimator();
        $zfContainer = $acclimator->acclimate($serviceLocator);
        $builder->wrapContainer($zfContainer);

        /**
         * @var $cache Cache
         */
        $cache = $this->getCache($serviceLocator, $config);

        if ($cache) {
            $builder->setDefinitionCache($cache);
        }

        $this->container = $builder->build();

        return $this->container;
    }