Create service

@param ServiceLocatorInterface $serviceLocator
@return Markdown
329032
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof AbstractPluginManager) {
            $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator;
        }

        return $this->create($serviceLocator);
    }
67769
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        //--------------------------------
        //data steps
        //  fetch
        //  filter
        //  sanitize
        //  parse
        //--------------------------------
        $fetch  = new FetchApplicationOutput();
        $dump   = new DumpConfigurationContent();

        $fetch->setCommand(new Command());
        $dump->setTimestamp(time());

        $pipe = new Pipe(
            //fetch data
            $fetch,
            //filter data
            new RemoveFirstLinesAndLastLine(),
            new RemoveColorsAndModuleHeadlines(),
            //sanitize data
            new RemoveIndexDotPhpFromLines(),
            //parse data
            new ParseToConfiguration(),
            $dump
        );

        return $pipe;
    }
1142248
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config')['mongoObjectMapper'];
        $client = self::constructMongoClient(@$config['uri'], @$config['options']);

        $mapperClass = 'MongoObject\Mapper';
        if (isset($config['mapperClass'])) {
            $mapperClass = $config['mapperClass'];
        }

        return new $mapperClass($client->selectDb($config['database']), @$config['modelsNamespace']);
    }
1103901
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        /* @var $translator \Zend\Mvc\I18n\Translator */
        $translator = $services->get('MvcTranslator');

        return new Translate($translator);
    }
157696
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $context = new RequestContext();
        $context->fromRequest($serviceLocator->get('Request'));

        return $context;
    }
72672
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $resource = new MessageHandler();

        $resource->setFinder($serviceLocator->getServiceLocator()->get(MessageHandlerFinder::class));

        return $resource;
    }
1321541
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $resolver = $serviceLocator->get('ViewResolver');
        $renderer = $serviceLocator->get('ViewRenderer');
        
        $pdfRenderer = new PdfRenderer();
        $pdfRenderer->setResolver($resolver);
        $pdfRenderer->setHtmlRenderer($renderer);
        $pdfRenderer->setEngine($serviceLocator->get(Dompdf::class));
        
        return $pdfRenderer;
    }
457589
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var array $config
         */
        $config = $serviceLocator->get('config');

        /**
         * @var \Zend\View\HelperPluginManager $serverUrl
         */
        $serverUrl = $serviceLocator->get('ViewHelperManager');

        /**
         * @var \Zend\Mvc\I18n\Translator $translator
         */
        $translator = $serviceLocator->get('translator');

        return new Search(
            $config,
            $serverUrl,
            $translator
        );
    }
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;
    }
155752
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return new AnnotationRouter(
            $serviceLocator->get('TjoAnnotationRouter\Options\Config'),
            $serviceLocator->get('TjoAnnotationRouter\Parser\ControllerParser'),
            new Merger(),
            $serviceLocator->get('ControllerLoader')
        );
    }
1081152
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $puppetDbClient = new Client();

        $options = $serviceLocator->get('KmbPuppetDb\Options\ModuleOptions');

        $httpClient = $serviceLocator->get('KmbPuppetDb\Http\Client');
        $httpClient->setOptions($options->getHttpOptions());

        $puppetDbClient->setHttpClient($httpClient);
        $puppetDbClient->setOptions($options);
        $puppetDbClient->setLogger($serviceLocator->get('Logger'));

        return $puppetDbClient;
    }
1078924
public function createService( ServiceLocatorInterface $serviceLocator )
    {
        // Configure the definitions
        $config     = $serviceLocator->get( 'Configuration' );
        $srvConfig  = isset( $config['modules']['Grid\Core']['settings'] )
                    ? (array) $config['modules']['Grid\Core']['settings']
                    : array();
        return new Definitions( $srvConfig );
    }
1282748
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        return new JQuery(
            $services->get(ModuleOptions::class),
            $services->get('JQueryPluginManager')
        );
    }
465558
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof AbstractPluginManager) {
            $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator;
        }
        return $this($serviceLocator, Asset::class);
    }
118518
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $annotationManager = new AnnotationManager();

        $parser = new DoctrineAnnotationParser();

        foreach ($this->defaultAnnotations as $annotationName) {
            $class = 'TjoAnnotationRouter\\Annotation\\' . $annotationName;
            $parser->registerAnnotation($class);
        }

        $annotationManager->attach($parser);

        return $annotationManager;
    }
1048529
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $options FormAnnotationBuilder */
        $options = $serviceLocator->get(FormAnnotationBuilder::class);

        $cache = $serviceLocator->has($options->getCache())
            ? $serviceLocator->get($options->getCache())
            : null;

        $builder = new AnnotationBuilder($cache);

        if ($serviceLocator->has('FormElementManager')) {
            $serviceLocator->get('FormElementManager')->injectFactory($builder);
        }

        foreach ($options->getAnnotations() as $annotation) {
            $builder->getAnnotationParser()->registerAnnotation($annotation);
        }

        $events = $builder->getEventManager();
        foreach ($options->getListeners() as $listener) {
            $listener = $serviceLocator->has($listener)
                ? $serviceLocator->get($listener)
                : new $listener();

            if (!$listener instanceof ListenerAggregateInterface) {
                throw new RuntimeException(sprintf(
                    'Invalid event listener (%s) provided',
                    get_class($listener)
                ));
            }

            $events->attach($listener);
        }

        if (null !== $options->getPreserveDefinedOrder()) {
            $builder->setPreserveDefinedOrder($options->getPreserveDefinedOrder());
        }

        return $builder;
    }
272531
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var \Zend\ServiceManager\ServiceLocatorAwareTrait $serviceLocator
         */
        $sl = $serviceLocator->getServiceLocator();

        /**
         * @var \Mp3\InputFilter\Search $inputFilterSearch
         */
        $inputFilterSearch = $sl->get('InputFilterManager')
                                ->get('Mp3\InputFilter\Search');

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

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

        return new SearchController(
            $inputFilterSearch,
            $formSearch,
            $serviceSearch
        );
    }