Create service

@param ServiceLocatorInterface $plugins
@return Object
@throws ServiceNotCreatedException if ModelManager service is not found in application service locator
339516
public function createService(ServiceLocatorInterface $plugins)
    {
        $services = $plugins->getServiceLocator();
        if (!$services instanceof ServiceLocatorInterface) {
            throw new ServiceNotCreatedException(sprintf(
                '%s requires that the application service manager has been injected; none found',
                __CLASS__
            ));
        }

        if (!$services->has('Matryoshka\Model\Object\ObjectManager')) {
            throw new ServiceNotCreatedException(sprintf(
                '%s requires that the application service manager contains a "%s" service; none found',
                __CLASS__,
                'Matryoshka\Model\Object\ObjectManager'
            ));
        }

        /** @var $objects \Matryoshka\Model\Object\ObjectManager */
        $objects = $services->get('Matryoshka\Model\Object\ObjectManager');
        return new Object($objects);
    }
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;
    }
1132648
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $mainCacheManager = new MainCacheManager();
        $logger = $serviceLocator->get('Logger');
        $cacheStorage = $serviceLocator->get('CacheService');
        $dateTimeFactory = $serviceLocator->get('DateTimeFactory');

        $config = $serviceLocator->get('Config');
        if (array_key_exists('cache_manager', $config)) {
            foreach ($config['cache_manager'] as $key => $cacheManagerConfig) {
                if (array_key_exists('service', $cacheManagerConfig)) {
                    /** @var AbstractCacheManager $cacheManager */
                    $cacheManager = $serviceLocator->get($cacheManagerConfig['service']);
                    if ($cacheManager instanceof AbstractCacheManager) {
                        $cacheManager->setLogger($logger);
                        $cacheManager->setCacheStorage($cacheStorage);
                        $cacheManager->setDateTimeFactory($dateTimeFactory);
                        $cacheManager->setKey($key);
                        $cacheManager->setDescription(array_key_exists('description', $cacheManagerConfig) ? $cacheManagerConfig['description'] : $key);
                        if ($cacheManager->getSuffixBuilder() == null) {
                            $cacheManager->setSuffixBuilder(new DefaultSuffixBuilder());
                        }
                        if ($cacheManager->getDataContextBuilder() == null) {
                            $cacheManager->setDataContextBuilder(new DefaultDataContextBuilder());
                        }
                        $mainCacheManager->addCacheManager($key, $cacheManager);
                    } else {
                        $logger->warn("Invalid configuration for cache manager $key : service should extends KmbCache\\Service\\AbstractCacheManager");
                    }
                } else {
                    $logger->warn("Invalid configuration for cache manager $key : missing service");
                }
            }
        }
        return $mainCacheManager;
    }
113556
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new ReportStatistics();
        /** @var Report $reportService */
        $reportService = $serviceLocator->get('KmbPuppetDb\Service\Report');
        $service->setReportService($reportService);
        return $service;
    }
578814
public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        $driver = new $config['ga-goo-gl']['client'];
        $driver->setAdapter($config['ga-goo-gl']['adapter']);
        $driver->setHeaders(array(
            'Content-Type' => 'application/json'
        ));
        $service = new Request();
        $service->setClient($driver);
        return $service;
    }
1230531
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator instanceof AbstractPluginManager ? $serviceLocator->getServiceLocator() : $serviceLocator;

        /** @var array $appConfig */
        $appConfig = $appServiceLocator->get('config');
        $moduleConfig = array_key_exists(Module::CONFIG_KEY, $appConfig) ? $appConfig[Module::CONFIG_KEY] : [];

        return new ModuleOptions($moduleConfig);
    }
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;
    }
395779
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $serviceLocator \Zend\Mvc\Controller\ControllerManager */
        $sm = $serviceLocator->getServiceLocator();

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

        $controller = new SupervisorController();
        $controller->setSupervisorPluginManager($pluginManager);

        return $controller;
    }
943798
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $serviceLocator = $serviceLocator->getServiceLocator();
        $helper = new FlashMessenger();
        $controllerPluginManager = $serviceLocator->get('ControllerPluginManager');
        $flashMessenger = $controllerPluginManager->get('flashmessenger');
        $helper->setPluginFlashMessenger($flashMessenger);
        $config = $serviceLocator->get('Config');
        if (isset($config['view_helper_config']['flashmessenger'])) {
            $configHelper = $config['view_helper_config']['flashmessenger'];
            if (isset($configHelper['message_open_format'])) {
                $helper->setMessageOpenFormat($configHelper['message_open_format']);
            }

            if (isset($configHelper['message_separator_string'])) {
                $helper->setMessageSeparatorString($configHelper['message_separator_string']);
            }

            if (isset($configHelper['message_close_string'])) {
                $helper->setMessageCloseString($configHelper['message_close_string']);
            }

            if (!empty($configHelper['class_messages'])) {
                $helper->setClassMessages($configHelper['class_messages']);
            }
        }

        return $helper;
    }
1125794
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $controller = new IndexController();

        /** @var ControllerManager $serviceLocator */
        $serviceManager = $serviceLocator->getServiceLocator();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $serviceManager->get('EnvironmentRepository');
        $controller->setEnvironmentRepository($environmentRepository);

        /** @var NodeInterface $nodeService */
        $nodeService = $serviceManager->get('KmbPuppetDb\Service\Node');
        $controller->setNodeService($nodeService);

        /** @var Logger $logger */
        $logger = $serviceManager->get('Logger');
        $controller->setLogger($logger);

        return $controller;
    }
304559
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, Writer\Db::class);
    }
782535
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var \Zend\ServiceManager\ServiceLocatorAwareTrait $serviceLocator
         */
        $sl = $serviceLocator->getServiceLocator();

        /**
         * @var \Mp3\Form\Search $formSearch
         */
        $formSearch = $sl->get('FormElementManager')
                         ->get('Mp3\Form\Search');

        /**
         * @var \Mp3\Service\Index $serviceIndex
         */
        $serviceIndex = $sl->get('Mp3\Service\Index');

        return new IndexController(
            $formSearch,
            $serviceIndex
        );
    }
102783
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, DoctrineWriter::class);
    }
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);
    }
716865
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var array  $appConfig */
        $appConfig = $serviceLocator->get('config');
        $doctrineConfig = array_key_exists('doctrine', $appConfig) ? $appConfig['doctrine'] : [];

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

        return new DoctrineOrmModuleConfig($doctrineConfig, $moduleOptions);
    }
812710
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var DoctrineObjectManagerInterface $doctrineObjectManager */
        $doctrineObjectManager = $serviceLocator->get(DoctrineObjectManagerInterface::class);

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

        /** @var EntityManagerInterface $entityManager */
        $entityManager = $serviceLocator->get(EntityManagerInterface::class);

        return new EntityMapBuilder($doctrineObjectManager, $moduleOptionsPluginManager, $entityManager);
    }
1298111
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var DoctrineObjectManagerInterface $objectManagerLocator */
        $objectManagerLocator = $serviceLocator->get(DoctrineObjectManagerInterface::class);

        return new ResolverManagerRegistryResourceListener($objectManagerLocator, $serviceLocator);
    }