(non-PHPdoc)

@see \Zend\ServiceManager\AbstractFactoryInterface::canCreateServiceWithName()
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']);
    }
1043384
protected function validateNameCreate()
    {
        $name = $this->getSubmitted('name');

        if (strlen($name) == 0) {
            $this->setErrorRequired('name', $this->translation->text('Name'));
            return false;
        }

        $pathinfo = pathinfo($name);

        if (!empty($pathinfo['extension'])) {
            // Validate filename. Allow only alphanumeric chars, underscores, dashes and dots
            $name = trim($pathinfo['dirname'], '.');
            if (preg_match('/^[\w-.]+$/', $pathinfo['basename']) !== 1) {
                $this->setErrorInvalid('name', $this->translation->text('Name'));
                return false;
            }
        }

        // Validate directory path
        if ($name && preg_match('/^[\w-]+[\w-\/]*[\w-]+$|^[\w-]$/', $name) !== 1) {
            $this->setErrorInvalid('name', $this->translation->text('Name'));
            return false;
        }

        return true;
    }
41220
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if ($serviceLocator instanceof AbstractPluginManager && $serviceLocator->getServiceLocator()) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        $config = $this->getConfig($serviceLocator);
        if (empty($config)) {
            return false;
        }

        return (
            isset($config[$requestedName])
            && is_array($config[$requestedName])
            && !empty($config[$requestedName])
            && isset($config[$requestedName]['datagateway'])
            && is_string($config[$requestedName]['datagateway'])
            && !empty($config[$requestedName]['datagateway'])
            && $serviceLocator->has($config[$requestedName]['datagateway'])
            && isset($config[$requestedName]['resultset'])
            && is_string($config[$requestedName]['resultset'])
            && !empty($config[$requestedName]['resultset'])
            && $serviceLocator->has($config[$requestedName]['resultset'])
        );
    }
805980
public function create($name, CredentialsInterface $credentials, StorageInterface $storage, $scopes = [], $baseApiUri = null, $apiVersion = null)
    {
      $name = ucfirst($name);

      if(is_null($this->client))
        $this->client = new CurlClient();

      $class = '\\LibX\OAuth2\\Service\\' . $name;

      if(!class_exists($class))
        throw new \Exception('Service with name ' . $name . ' not found');

      return new $class($credentials, $this->client, $storage, $scopes, $baseApiUri);
    }
1001547
protected function buildService($serviceDefinition, $interfaceName = null)
    {
        if ($serviceDefinition instanceof ConfigurableService) {
            if (is_null($interfaceName) || is_a($serviceDefinition, $interfaceName)) {
                $this->propagate($serviceDefinition);
                return $serviceDefinition;
            } else {
                throw new InvalidService('Service must implements ' . $interfaceName);
            }
        } elseif (is_array($serviceDefinition) && isset($serviceDefinition['class'])) {
            $classname = $serviceDefinition['class'];
            $options = isset($serviceDefinition['options']) ? $serviceDefinition['options'] : [];
            if (is_null($interfaceName) || is_a($classname, $interfaceName, true)) {
                return $this->getServiceManager()->build($classname, $options);
            } else {
                throw new InvalidService('Service must implements ' . $interfaceName);
            }
        } else {
            throw new InvalidService();
        }
    }
1122970
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if (substr($name, -5) != 'table') {
            return false;
        }

        if (empty($this->config)) {
            $config = $serviceLocator->get('config');
            $this->config = isset($config['tables']) ? $config['tables'] : [];
        }

        if (!isset($this->config[$requestedName])) {
            return false;
        }

        return true;
    }
586221
public function getName()
    {
        if (!null === $this->name) {
            $errMsg = 'service name not exists';
            throw new Exception\InvalidServiceConfigException($errMsg);
        }
        return $this->name;
    }
208276
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if ($serviceLocator instanceof AbstractPluginManager && $serviceLocator->getServiceLocator()) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        $config = $this->getConfig($serviceLocator)[$requestedName];

        //Create an object instance
        $class = $config['type'];
        if (!class_exists($class)) {
            throw new Exception\RuntimeException(sprintf(
                'ObjectAbstractServiceFactory expects the "type" to be a valid class; received "%s"',
                $class
            ));
        }
        $object = new $class;

        //Setup Hydrator
        $hydrator = null;
        if ($object instanceof HydratorAwareInterface
            && isset($config['hydrator'])
            && is_string($config['hydrator'])
            && !empty($config['hydrator'])
        ) {
            $object->setHydrator($this->getHydratorByName($serviceLocator, $config['hydrator']));
        }

        //Setup InputFilter
        if ($object instanceof InputFilterAwareInterface
            && isset($config['input_filter'])
            && is_string($config['input_filter'])
            && !empty($config['input_filter'])
        ) {
            $object->setInputFilter($this->getInputFilterByName($serviceLocator, $config['input_filter']));
        }

        //Setup ActiveRecord
        if ($object instanceof AbstractActiveRecord
            && isset($config['active_record_criteria'])
            && is_string($config['active_record_criteria'])
            && !empty($config['active_record_criteria'])
        ) {
            $object->setActiveRecordCriteriaPrototype($this->getActiveRecordCriteriaByName(
                $serviceLocator,
                $config['active_record_criteria']
            ));
        }

        return $object;
    }
1265800
private function buildFactoryArgument()
    {
        if ($this->serviceConfig->keyExists('Factory')) {
            $factory = $this->str($this->serviceConfig->key('Factory'));
            $arguments = $this->serviceConfig->key('Arguments', null, true);
            // If it's a STATIC method call - unset all arguments
            if ($this->serviceConfig->key('Static', true, true) && !$factory->startsWith('@')) {
                $arguments = [];
            }
            $factoryArgument = new FactoryArgument($this->serviceConfig->key('Factory'), $arguments,
                                                   $this->serviceConfig->key('Static')
            );
            $this->serviceConfig->key('Factory', $factoryArgument);
        }
    }
1221418
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        return $this->getContainer($serviceLocator)->has($requestedName);
    }
573714
public function build(): RequestDatabaseNamesRequest
	{
		$instance = new RequestDatabaseNamesRequest();
		if ($this->securityOrigin === null) {
			throw new BuilderException('Property [securityOrigin] is required.');
		}
		$instance->securityOrigin = $this->securityOrigin;
		return $instance;
	}
1175703
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        try {
            $di = $this->getDiContainer($serviceLocator);
        } catch (\Exception $e) {
            return false;
        }

        $class = str_replace('.', '\\', $requestedName);
        if (class_exists($class) || $di->instanceManager()->hasAlias($requestedName)) {
            return true;
        }

        return false;
    }
629077
public function createNamed(
        $name = null,
        CollectionInterface $filterCollection,
        array $rootFormBuilderOptions = [],
        array $filterFormBuilderOptions = []
    ) {
        return $this->createForm($filterCollection, $name, $rootFormBuilderOptions, $filterFormBuilderOptions);
    }
515367
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $allConfigs = $this->getConfig($serviceLocator);
        $config = $allConfigs[$requestedName];
        $httpClient = new HttpClient();
        if (isset($config['http_client_options'])) {
            $httpClient->setOptions($config['http_client_options']);
        }
        $client = new Client($httpClient, $config['base_uri']);
        if (isset($config['default_headers'])) {
            $client->setDefaultHeaders($config['default_headers']);
        }
        if (isset($config['throw_exceptions'])) {
            $client->setThrowExceptions($config['throw_exceptions']);
        }
        return $client;
    }
1026443
private function createService($name)
    {
        $entry = &$this->services[$name];

        if (!is_array($entry) || !isset($entry['class'])) {
            throw new ContainerException($name.' service entry must be an array containing a \'class\' key');
        } elseif (!class_exists($entry['class'])) {
            throw new ContainerException($name.' service class does not exist: '.$entry['class']);
        } elseif (isset($entry['lock'])) {
            throw new ContainerException($name.' contains circular reference');
        }

        $entry['lock'] = true;

        $arguments = isset($entry['arguments']) ? $this->resolveArguments($entry['arguments']) : [];

        $reflector = new \ReflectionClass($entry['class']);
        $service = $reflector->newInstanceArgs($arguments);

        if (isset($entry['calls'])) {
            $this->initializeService($service, $name, $entry['calls']);
        }

        return $service;
    }
877579
static function createFromName($name, ClassIndexInterface $autoloadSource) {
    $reflectionClass = new \ReflectionClass($name);
    return self::createFromReflection($name, $reflectionClass, $autoloadSource);
  }
590125
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->getConfig($serviceLocator)[$requestedName];

        $httpClient = isset($config['http_client']) && $serviceLocator->has($config['http_client']) ?
        $serviceLocator->get($config['http_client']) : null;

        $baseRequest = isset($config['base_request']) && $serviceLocator->has($config['base_request']) ?
        $serviceLocator->get($config['base_request']) : null;

        $api = new HttpApi($httpClient, $baseRequest);

        // Array of int code valid
        if (isset($config['valid_status_code']) && is_array($config['valid_status_code'])) {
            $api->setValidStatusCodes($config['valid_status_code']);
        }
        // string json/xml
        if (isset($config['request_format'])) {
            $api->setRequestFormat($config['request_format']);
        }
        // Profiler
        if (isset($config['profiler']) && $serviceLocator->has($config['profiler'])) {
            $api->setProfiler($serviceLocator->get($config['profiler']));
        }

        return $api;
    }