Create service with name

@param ServiceLocatorInterface $serviceLocator
@param                         $name
@param                         $requestedName

@return mixed
515854
public function createServiceWithName(
        ServiceLocatorInterface $serviceLocator,
        $name,
        $requestedName
    ) {
        return new BaseController(
            $serviceLocator->getServiceLocator()->get('Config'),
            $requestedName,
            $serviceLocator
        );
    }
1284723
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        return $appServiceLocator->get($requestedName);
    }
329032
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($serviceLocator instanceof AbstractPluginManager) {
            $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator;
        }

        return $this->create($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
        );
    }
827687
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var array $appConfig */
        $appConfig = $serviceLocator->get('config');
        $config = [];
        if (array_key_exists(Module::CONFIG_KEY, $appConfig)) {
            $config = $appConfig[Module::CONFIG_KEY];
        }
        $moduleOptions = new ModuleOptions($config);
        return $moduleOptions;
    }
1141150
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $r = new ReflectionClass($requestedName);
        return $r->newInstance();
    }
977571
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        try {
            $identifiers = self::splitIntoIdentifiers($requestedName);
        } catch (ProcessException $e) {
            return false;
        }
        
        return $this->getDatatypesHandler($serviceLocator)->hasDataType($identifiers['mode'], $identifiers['type'], $identifiers['endpoint']);
    }
519999
public function canCreate(ContainerInterface $serviceLocator, $requestedName)
    {
        if (substr($requestedName, -6) == self::WIDGET_SUFFIX) {
            /** @var $util \PageBuilder\Util\Widget */
            $util     = $serviceLocator->get('util\widget');
            $widgetId = str_replace(self::WIDGET_SUFFIX, '', $requestedName);

            return $util->widgetExist($widgetId);
        }

        return false;
    }
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;
    }
442040
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        return $appServiceLocator->has($requestedName);
    }
461444
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $routeCollection = new RouteCollection();
        $requestContext  = $serviceLocator->get('RouterRequestContext');
        $routerOptions   = array();

        $logger = $serviceLocator->has('logger') ? $serviceLocator->get('Logger') : null;

        $router = new Router($requestContext, $routeCollection, $routerOptions, $logger);

        // @todo - consider making a base router class, and then have a ModuleRouterFactory to pull module routes
        // @todo - find a way to set routes on this after we instantiate this factory

        // @todo - let you add new routes on demand and call $router->setRouteCollection()
        return $router;
    }
469457
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        return substr($requestedName, - strlen(self::$termination)) === self::$termination && array_key_exists($this->removeTermination($requestedName), $this->getFormaterIndex($serviceLocator));
    }
57270
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->configs[$requestedName];
        if (!$config['type']) {
            throw new \RuntimeException('Unknown "type" config.');
        }
        if (!$config['options']) {
            throw new \RuntimeException('Unknown "options" config.');
        }

        $className = __NAMESPACE__ . '\\Adapter\\' . ucfirst($config['type']);
        if (!class_exists($className)
            || !in_array(__NAMESPACE__ . '\\Adapter\\StorageInterface', class_implements($className))
        ) {
            throw new \RuntimeException('Error config type:' . $config['type']);
        }

        /** @var Adapter\AbstractStorageAdapter $fileStorage */
        $fileStorage = new $className($config['options']);

        /**
         * @var \Zend\Validator\ValidatorPluginManager $vm
         * @var \Zend\Filter\FilterPluginManager $fm
         */
        $vm = $serviceLocator->get('ValidatorManager');
        $fm = $serviceLocator->get('FilterManager');
        $fm->setInvokableClass('lowercasename', 'Gzfextra\FileStorage\Filter\LowerCaseName');
        $fm->setInvokableClass('renameupload', 'Gzfextra\FileStorage\Filter\RenameUpload');

        $this->setFileAlias($vm, $fm);

        $fileStorage->getValidatorChain()->setPluginManager($vm);
        $fileStorage->getFilterChain()->setPluginManager($fm);

        if (isset($config['options']['validators'])) {
            $fileStorage->addValidators($config['options']['validators']);
        }

        if (isset($config['options']['filters'])) {
            $fileStorage->addFilters($config['options']['filters']);
        }
        return $fileStorage;
    }
851648
public static function factory(ContainerInterface $container, $requestedName, array $options=[])
    {
        $ob = new self($options);
        $ob->setContainer($container);
        return $ob;
    }
99488
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new PuppetClass();

        /** @var PuppetModule $moduleService */
        $moduleService = $serviceLocator->get('pmProxyPuppetModuleService');
        $service->setModuleService($moduleService);

        return $service;
    }
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
        );
    }
280152
public function createService(ServiceLocatorInterface $serviceLocator, $name = null)
    {
        $config = $serviceLocator->get('Config');

        if (! $config['ocra_service_manager']['logged_service_manager']) {
            return $serviceLocator;
        }

        /* @var $proxyFactory \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory */
        $proxyFactory = $serviceLocator->get('OcraServiceManager\\ServiceManager\\AccessInterceptorProxyFactory');
        /* @var $locatorInterceptors \Closure[] */
        $locatorInterceptors = $serviceLocator->get('OcraServiceManager\\ServiceManager\\AccessInterceptors');

        // @todo maybe this should be a callback, and `locatorInterceptors` should not be used explicitly
        $proxyLocator = $proxyFactory->createProxy($serviceLocator, array(), $locatorInterceptors);

        if (! ($name && $serviceLocator instanceof ServiceManager)) {
            return $proxyLocator;
        }

        // @todo this service hardcoding should be removed
        $allowOverrides = $serviceLocator->getAllowOverride();

        $serviceLocator->setAllowOverride(true);
        $serviceLocator->setService('ServiceManager', $proxyLocator);
        $serviceLocator->setAllowOverride($allowOverrides);

        return $proxyLocator;
    }