@return ServiceLocatorInterface

@throws \OldTown\Workflow\Doctrine\ZF2\Exception\RuntimeException
502992
public function getServiceLocator()
    {
        if ($this->serviceLocator) {
            return $this->serviceLocator;
        }

        $this->serviceLocator = static::getDefaultServiceLocator();

        return $this->serviceLocator;
    }
1257818
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

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

        return new LocationTranslator($locations);
    }
1304036
private function resolveContainer(): ContainerInterface
    {
        if ($this->container === null) {
            $container = $this->containerFactory->build($this);

            if (!$container instanceof ContainerInterface) {
                throw new \RuntimeException(
                    "Invalid factory result, expected ContainerInterface"
                );
            }

            $this->container = $container;
        }

        return $this->container;
    }
978618
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        if (!isset($config['cache_manager'])) {
            throw new Exception\RuntimeException(
                'No cache manager config found.'
            );
        }
        $options = $config['cache_manager'];
        $manager = new CacheManager;
        foreach ($options as $key => $value) {
            if ($manager->hasCacheTemplate($key)) {
                $manager->setTemplateOptions($key, $value);
            } else {
                $manager->setCacheTemplate($key, $value);
            }
        }
        return $manager;
    }
474902
public function getClient()
    {
        $client = $this->reduceFirst(function (SearchProviderInterface $provider) {
            return $provider->getClient();
        });

        if (null === $client) {
            throw new \RuntimeException('No provider was able to return a client');
        }

        return $client;
    }
416347
public function getServiceLocator()
	{
		if (is_null($this->_serviceLocator))
			$this->_serviceLocator = new ServiceManager(new Config()); //ServiceLocatorFactory::getInstance();
		return $this->_serviceLocator;
	}
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
        );
    }
391994
public function getActiveProvider()
    {
        if ($this->activeProvider instanceof ProviderInterface) {
            return $this->activeProvider;
        }

        if (empty($this->providers)) {
            throw new RuntimeException('No versioning provider found');
        }

        foreach ($this->providers as $entry) {
            $provider = $entry['provider'];
            /** @var $provider ProviderInterface */
            if ($provider->isSupported()) {
                $this->activeProvider = $provider;

                return $provider;
            }
        }

        throw new RuntimeException('No supported versioning providers found');
    }
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);
    }
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);
    }
566337
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $serviceLocator = $serviceLocator->getServiceLocator();
        $helper = new GlobalMessenger();
        $controllerPluginManager = $serviceLocator->get('ControllerPluginManager');
        $globalMessenger = $controllerPluginManager->get('globalMessenger');
        $helper->setPluginGlobalMessenger($globalMessenger);
        $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']);
            }
        }

        return $helper;
    }
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;
    }
230799
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $this->isAllowed = $serviceLocator->get(
            IsAllowed::class
        );

        $this->currentSite = $serviceLocator->get(\Rcm\Service\CurrentSite::class);

        $config = $serviceLocator->get('config');

        $this->findPage = $serviceLocator->get(FindPage::class);

        $this->findRevisionList = $serviceLocator->get(FindRevisionList::class);

        $application = $serviceLocator->get('Application');

        /** @var RouteMatch $routeMatch */
        $routeMatch = $application->getMvcEvent()->getRouteMatch();

        if (!in_array(
            $routeMatch->getMatchedRouteName(),
            $config['Rcm']['RcmCmsPageRouteNames']
        )
        ) {
            return parent::createService($serviceLocator);
        }

        $pageMatch = $routeMatch->getParam('page', 'index');

        if ($pageMatch instanceof Page) {
            $pageMatch = $pageMatch->getName();
        }

        $this->pageRevision = $routeMatch->getParam('revision', null);
        $pageTypeMatch = $routeMatch->getParam('pageType', 'n');

        if (!empty($pageMatch)) {
            $this->page = $this->findPage->__invoke(
                $this->currentSite->getSiteId(),
                $pageMatch,
                $pageTypeMatch
            );
        }

        return parent::createService($serviceLocator);
    }
950309
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Configuration');
        if (!isset($config['ocr'])) {
            throw new Exception\RuntimeException('No "ocr" section available in configuration.');
        }
        if (!isset($config['ocr']['service'])) {
            throw new Exception\RuntimeException('No "service" specified in "ocr" section of configuration.');
        }
        $service = $serviceLocator->get($config['ocr']['service']);
        if (!$service instanceof OcrServiceInterface) {
            throw new Exception\RuntimeException('Provided service class is not a valid ocr service.');
        }
        if (isset($config['ocr']['config'])) {
            $service->setConfig($config['ocr']['config']);
        }
        return $service;
    }
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);
    }
278952
protected function getClientHost()
    {
        if ($this->requestStack->getCurrentRequest() === null) {
            throw new \RuntimeException(sprintf('%s can not be called outside of request cycle', __METHOD__));
        }

        return $this->requestStack->getCurrentRequest()->getHost();
    }
851936
public static function getInstance(): BladeInterface
    {
        if (!static::$instance) {
            # Calculate the parent of the vendor directory
            $path = realpath(__DIR__ . "/../../../..");
            if (!is_string($path) || !is_dir($path)) {
                throw new \RuntimeException("Unable to locate the root directory: {$path}");
            }

            static::$instance = new BladeInstance("{$path}/views", "{$path}/cache/views");
        }

        return static::$instance;
    }