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

    }