src/Service/SnippetHelperServiceFactory.php
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);

    }
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);

    }
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 ) ; }
Create an appender helper service
@param ServiceLocatorInterface $serviceLocator
@return SnippetHelper
Create an appender helper service