Builds a service management object.

@param string $connectionString The configuration connection string

@return IServiceManagement
177045
public function createServiceManagementService($connectionString)
    {
        $settings = ServiceManagementSettings::createFromConnectionString(
            $connectionString
        );

        $certificatePath = $settings->getCertificatePath();
        $httpClient = new HttpClient($certificatePath);
        $serializer = $this->serializer();
        $uri = Utilities::tryAddUrlScheme(
            $settings->getEndpointUri(),
            Resources::HTTPS_SCHEME
        );

        $serviceManagementWrapper = new ServiceManagementRestProxy(
            $httpClient,
            $settings->getSubscriptionId(),
            $uri,
            $serializer
        );

        // Adding headers filter
        $headers = [];

        $headers[Resources::X_MS_VERSION] = Resources::SM_API_LATEST_VERSION;

        $headersFilter = new HeadersFilter($headers);
        $serviceManagementWrapper = $serviceManagementWrapper->withFilter(
            $headersFilter
        );

        return $serviceManagementWrapper;
    }
1132581
public function getServicePluginManager()
	{
	    if($this->servicePluginManager === null){
	        $this->servicePluginManager = new ServicePluginManager();
	        $that = $this;
	
	        $this->servicePluginManager->addInitializer(function ($instance, $serviceManager) use ($that) {
	             
	            $name     = $serviceManager->getCreationInstanceName();
	            $options  = $serviceManager->getCreationInstanceOptions();
	             
	            /**
	             * Configure service
	            */
	            if($options !== null && sizeof($options) &&
	               $instance instanceof Feature\ConfigurableInterface){
	
	                $instance->setConfig($options);
	            }
	        });
	    }
	     
	    return $this->servicePluginManager;
	}
1326238
private function createContainer($settings)
    {
        if (is_string($settings)) {
            return $this->createContainerFromString($settings);
        }

        if (is_array($settings)) {
            return $this->createContainerFromArray($settings);
        }

        throw new WrongServicesConfigurationException(
            sprintf('`services` must be either string or an array, but `%s` given.', gettype($settings))
        );
    }
911641
public static function create($connectionString)
    {
        if (!$connectionString instanceof Uri) {
            $uri = new Uri($connectionString);
        } else {
            $uri = $connectionString;
        }

        $scheme = ucfirst($uri->getScheme());

        $class = explode('\\', get_class());
        array_pop($class);
        $class[] = strpos($scheme, 'Pdo') === 0 ? 'Pdo' : $scheme;
        $class[] = $scheme;
        $class = implode('\\', $class);

        $db = new $class();
        $db->uri = $uri;

        return $db;
    }
247439
public static function createFromJsonResponse($jsonString)
    {
        $data = json_decode($jsonString, true);
        if (\is_array($data) && isset($data['items'])) {
            return array_map(function ($membership) {
                return self::getObjectFromArray($membership);
            }, $data['items']);
        }

        return self::getObjectFromArray($data);
    }
1179942
public static function fromJson(string $jsonString): ApiContext
    {
        $apiContext = new static();
        $contextJson = \GuzzleHttp\json_decode($jsonString, true);
        $apiContext->environmentType = new BunqEnumApiEnvironmentType($contextJson[self::FIELD_ENVIRONMENT_TYPE]);
        $apiContext->apiKey = $contextJson[self::FIELD_API_KEY];
        $apiContext->proxyUrl = static::restoreProxyUrl($contextJson);
        $apiContext->installationContext = InstallationContext::restore($contextJson[self::FIELD_INSTALLATION_CONTEXT]);
        $apiContext->sessionContext = SessionContext::restore($contextJson[self::FIELD_SESSION_CONTEXT]);

        return $apiContext;
    }
642615
protected function buildManager()
    {
        $config = new Configuration;

        $this->setUpGeneralConfigurations($config);
        $this->setUpSpecificConfigurations($config);

        $documentManager = DocumentManager::create($this->getOption('connection'), $config, $this->getEventManager());

        if ($this->getRepositoryFactory() !== null) {
            $documentManager->setRepositoryFactory($this->getRepositoryFactory());
        }

        if ($this->getDefaultRepositoryClass() !== null) {
            $documentManager->setDefaultRepositoryClassName($this->getDefaultRepositoryClass());
        }

        return $documentManager;
    }
1038933
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptions $mapOptions */
        $moduleOptions = $serviceLocator->get('AxalianAchievements\Options\ModuleOptions');

        $pluginManager = new AchievementProviderPluginManager(new Config($moduleOptions->getAchievementProviders()));
        $pluginManager->setServiceLocator($serviceLocator);

        return $pluginManager;
    }
8208
private function createValue($object, $arguments = [])
    {

        if ($this->isInstanceOf($arguments, ConfigObject::class)) {
            $arguments = $arguments->toArray();
        }

        if (!$this->isArray($arguments)) {
            throw new ServiceManagerException(ServiceManagerException::INVALID_SERVICE_ARGUMENTS_TYPE, [$object]);
        }

        if (!$this->isString($object)) {
            return $object;
        }

        $object = $this->str($object);

        if ($object->startsWith('@')) {
            return ServiceManager::getInstance()->getService($object->trimLeft('@')->val());
        } else {
            $value = $object->val();
            if (class_exists($value)) {
                $reflection = new \ReflectionClass($value);

                return $reflection->newInstanceArgs($arguments);
            }

            return $value;
        }
    }
275175
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');
        $transportClass = 'Zend\\Mail\\Transport\\Sendmail';
        if(isset($config['contact']['transport_class']) && class_exists($config['contact']['transport_class'], true)){
            $transportClass = $config['contact']['transport_class'];
        }
        return new $transportClass($config);
    }
1025067
public static function setConnectionString( $connectionString, $userName = null, $password = null, $pdoOptions = array() )
    {
        self::setConnection( null );

        //	If you set a connection string a new connection one is created for you
        if ( !empty( $connectionString ) )
        {
            self::$_connectionString = $connectionString;

            self::$_connection = new \PDO(
                self::$_connectionString, $userName, $password, array_merge(
                    array(
                        \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
                    ),
                    $pdoOptions
                )
            );
        }

        return self::$_connection;
    }
1125794
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $controller = new IndexController();

        /** @var ControllerManager $serviceLocator */
        $serviceManager = $serviceLocator->getServiceLocator();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $serviceManager->get('EnvironmentRepository');
        $controller->setEnvironmentRepository($environmentRepository);

        /** @var NodeInterface $nodeService */
        $nodeService = $serviceManager->get('KmbPuppetDb\Service\Node');
        $controller->setNodeService($nodeService);

        /** @var Logger $logger */
        $logger = $serviceManager->get('Logger');
        $controller->setLogger($logger);

        return $controller;
    }
122194
public static function getDriver(string $connectionString)
    {
        $connection = [
            'orig' => $connectionString,
            'type' => null,
            'user' => null,
            'pass' => null,
            'host' => null,
            'port' => null,
            'name' => null,
            'opts' => []
        ];
        $aliases = [
            'mysqli' => 'mysql',
            'pg' => 'postgre',
            'oci' => 'oracle',
            'firebird' => 'ibase'
        ];
        $connectionString = array_pad(explode('://', $connectionString, 2), 2, '');
        $connection['type'] = $connectionString[0];
        $connectionString = $connectionString[1];
        if (strpos($connectionString, '@') !== false) {
            $connectionString = array_pad(explode('@', $connectionString, 2), 2, '');
            list($connection['user'], $connection['pass']) = array_pad(explode(':', $connectionString[0], 2), 2, '');
            $connectionString = $connectionString[1];
        }
        $connectionString = array_pad(explode('/', $connectionString, 2), 2, '');
        list($connection['host'], $connection['port']) = array_pad(explode(':', $connectionString[0], 2), 2, null);
        $connectionString = $connectionString[1];
        if ($pos = strrpos($connectionString, '?')) {
            $opt = substr($connectionString, $pos + 1);
            parse_str($opt, $connection['opts']);
            if ($connection['opts'] && count($connection['opts'])) {
                $connectionString = substr($connectionString, 0, $pos);
            } else {
                $connection['opts'] = [];
            }
        }
        $connection['name'] = $connectionString;
        $connection['type'] = isset($aliases[$connection['type']]) ?
            $aliases[$connection['type']] :
            $connection['type'];
        $tmp = '\\vakata\\database\\driver\\'.strtolower($connection['type']).'\\Driver';
        return new $tmp($connection);
    }
125748
public static function setupPDO($connectionString, $user, $password)
    {
        try {
            self::$pdoInstance = new PDO($connectionString, $user, $password);
        } catch (PDOException $e) {
            trigger_error($e->getMessage(), E_USER_ERROR);
        }
    }
308800
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */
        $objectManagerAutoDetector = $serviceLocator->get(ObjectManagerAutoDetectorInterface::class);

        /** @var EntityManagerInterface $entityManager */
        $entityManager = $serviceLocator->get(EntityManagerInterface::class);

        return new ObjectManagerService($objectManagerAutoDetector, $entityManager);
    }
396784
public function setConnection($connectionConfig)
    {
        self::$config = static::parseUrl($connectionConfig);

        try {
            return  static::createConnection(self::$config);
        } catch (\PDOException $e) {
            throw new \Exception($e->getMessage());
        }
    }
126354
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ServiceManager $serviceManager */
        $serviceManager = $serviceLocator->getServiceLocator();

        $controller = new EnvironmentsController();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $serviceManager->get('EnvironmentRepository');
        $controller->setEnvironmentRepository($environmentRepository);

        /** @var UserRepositoryInterface $userRepository */
        $userRepository = $serviceManager->get('UserRepository');
        $controller->setUserRepository($userRepository);

        /** @var \KmbPmProxy\Service\EnvironmentInterface $pmProxyEnvironmentService */
        $pmProxyEnvironmentService = $serviceManager->get('KmbPmProxy\Service\Environment');
        $controller->setPmProxyEnvironmentService($pmProxyEnvironmentService);

        return $controller;
    }