Returns Google Client class instance
@param array $settings
@return \Google_Client
@throws OutOfRangeException
17976
protected function getClient(array $settings)
    {
        if (empty($settings['credential_id'])) {
            throw new OutOfRangeException('Credential ID is empty in Google client settings');
        }

        $client = $this->getApiModule()->getGoogleClient($settings['credential_id']);
        $client->setApplicationName('Analytics Reporting');
        $client->setScopes(array('https://www.googleapis.com/auth/analytics.readonly'));

        return $client;
    }
69753
public function get(string $class)
    {
        if (isset($this->instantiated[$class]) && $this->shared[$class]) {
            return $this->instantiated[$class];
        }

        $args = $this->services[$class];

        switch (count($args)) {
            case 0:
                $object = new $class();
                break;
            case 1:
                $object = new $class($args[0]);
                break;
            case 2:
                $object = new $class($args[0], $args[1]);
                break;
            case 3:
                $object = new $class($args[0], $args[1], $args[2]);
                break;
            default:
                throw new \OutOfRangeException('Too many arguments given');
        }

        if ($this->shared[$class]) {
            $this->instantiated[$class] = $object;
        }

        return $object;
    }
355796
public function setSettings(array $settings = []) : self
    {
        $this->settings = array_merge($this->settings, $settings);
        // loop through checking each setting
        foreach ($this->allowedSettings as $name => $allowed) {
            $this->validateSettings->__invoke($name, $this->settings[$name], $allowed);
        }

        return $this;
    }
476394
public static function getConnection(array $options): Client
    {
        if (self::$connection === null) {
            $builder = new ClientBuilder([
                'cw.endpoint_uri' => $options['environment'] == 0 ? CodesWholesale::SANDBOX_ENDPOINT : CodesWholesale::LIVE_ENDPOINT,
                'cw.client_id' => $options['environment'] == 0 ? self::SANDBOX_CLIENT_ID : $options['client_id'],
                'cw.client_secret' => $options['environment'] == 0 ? self::SANDBOX_CLIENT_SECRET : $options['client_secret'],
                'cw.token_storage' => isset($options['db']) && $options['db'] instanceof \PDO ? new TokenDatabaseStorage($options['db'], $options['prefix']) : new TokenSessionStorage(),
                'cw.client.headers' => [
                    'User-Agent' => $options['client_headers'],
                ],
                'cw.signature' => isset($options['signature']) ? $options['signature'] : self::SANDBOX_SIGNATURE
            ]);

            self::$connection = $builder->build();
       }
        
        return self::$connection;
    }
57095
protected function getConnectionDriver(array $settings = [])
    {
        $connection = Arr::get($settings, 'connection');
        $key        = 'database.connections.' . $connection;

        if (!$this->config->has($key)) {
            throw new InvalidArgumentException("Connection [{$connection}] has no configuration in [{$key}]");
        }

        return $this->config->get($key);
    }
1311173
public function getClient($accessToken) {
        $client = new Google_Client();
        $client->setApplicationName($this->applicationName);
        $client->setAccessType('offline');

        $client->setAccessToken($accessToken);

        // Refresh the token if it's expired.
        if ($client->isAccessTokenExpired()) {
            $client->setAuthConfigFile(Yii::getAlias($this->clientSecretPath));
            $client->refreshToken($client->getRefreshToken());
            $this->saveAccessToken($client->getAccessToken());
        }
        return $client;
    }
55673
public function getClient($name = null)
    {
        if (null === $name) {
            $name = $this->defaultClientName;
        }

        if (in_array($name, $this->getClientNames())) {
            return $this->clients[$name];
        }

        throw new \InvalidArgumentException(($name === null ? 'default client' : 'client ' . $name) . ' not configured');
    }
1147340
protected function _getClient(array $config) {
        $ini = Zend_Registry::get('config');
        $type = !empty($ini->store->type) ? $ini->store->type : 'Session';
        if ($type == 'Cookie') {
            return new Garp_Social_Facebook_Client($config);
        } else {
            require_once APPLICATION_PATH.'/../garp/library/Garp/3rdParty/facebook/src/facebook.php';
            $facebook = new Facebook($config);
            return $facebook;
        }
    }
405385
public static function getInstance(array $options = array())
    {
        if (self::$instance === false) {
            $ret = new ClientImpl($options);
            self::$instance = $ret;
        } else {
            $ret = self::$instance;
        }
        return $ret;
    }
851379
protected function getClient()
	{
		if (!static::$client) {
			static::$client = new \AlgoliaSearch\Client(
				Config::get('search.connections.algolia.config.application_id'),
				Config::get('search.connections.algolia.config.admin_api_key')
			);
		}
		
		return static::$client;
	}
1191724
public static function getInstance($setting = [])
    {
        if (!(self::$_instance instanceof self)) {
            self::$_instance = new self($setting);
        }
        return self::$_instance;
    }
181187
public static function getInstance(array $options = array())
    {
        if (self::$instance === false) {
            $ret = new CallSpoolImpl($options);
            self::$instance = $ret;
        } else {
            $ret = self::$instance;
        }
        return self::$instance;
    }
177203
public static function configureOAuth($settings)
    {
        if (!isset($settings['auth_token'])) {
            throw new Exception("'auth_token' must be provided");
        }

        if (!isset($settings['store_hash'])) {
            throw new Exception("'store_hash' must be provided");
        }

        self::$client_id = $settings['client_id'];
        self::$auth_token = $settings['auth_token'];
        self::$store_hash = $settings['store_hash'];

        self::$client_secret = isset($settings['client_secret']) ? $settings['client_secret'] : null;

        self::$api_path = self::$api_url . sprintf(self::$stores_prefix, self::$store_hash);
        self::$connection = false;
    }
550899
protected function getClient(array $config)
    {
        $name = array_get($config, 'adapter');
        $config = $this->manager->getConnectionConfig($name);

        return $this->manager->getFactory()->createAdapter($config);
    }
1068457
public static function initStatic(array $settings): array
    {
        $settings += static::$settings ?? [];
        foreach ($settings as $name => &$value) {
            $propertyName = null;
            if (property_exists(static::class, $name)) {
                $propertyName = $name;
                unset($settings[$name]);
            }

            if ($propertyName === null
                && property_exists(static::class, NameConverter::snakeCaseToCamelCase($name))) {
                $propertyName = NameConverter::snakeCaseToCamelCase($name);
                unset($settings[$name]);
            }

            $methodName = 'set' . $propertyName;
            if (is_callable([static::class, $methodName])) {
                static::{$methodName}($value);
                continue;
            }

            if (array_key_exists($propertyName, get_class_vars(static::class))) {
                static::${$propertyName} = $value;
            }
        }

        unset($value);

        return $settings;
    }
868308
public static function setClient($input=null)
    {
        // New or encapsulate
        self::$client = ($input instanceof Google_client) ? $input : new Google_Client();

        // While new and there has the config
        if (is_array($input)) {
            
            foreach ($input as $key => $value) {
                // ex. 'authConfig' => setAuthConfig()
                $method = "set" . ucfirst($key);
                // Config method check
                if (!method_exists(self::$client, $method)) {
                    throw new Exception("setClient() Config Key: `{$key}` is invalid referred to Google_Client->{$method}()", 500);
                }
                // Call set method by Google_Client
                call_user_func([self::$client, $method], $value);
            }
        }

        return new self;
    }
993047
protected function initObject(array $settings): array
    {
        $settings += static::$settings ?? [];
        foreach ($settings as $name => &$value) {
            $propertyName = null;
            if (property_exists($this, $name)) {
                $propertyName = $name;
                unset($settings[$name]);
            }

            if ($propertyName !== null
                && property_exists($this, NameConverter::snakeCaseToLowerCamelCase($name))) {
                $propertyName = NameConverter::snakeCaseToLowerCamelCase($name);
                unset($settings[$name]);
            }

            if (!$propertyName) {
                continue;
            }

            $methodName = 'set' . ucfirst($propertyName);
            if (is_callable([$this, $methodName])) {
                $this->{$methodName}($value);
                continue;
            }

            if (array_key_exists($propertyName, get_object_vars($this))) {
                $this->{$propertyName} = $value;
            }
        }

        unset($value);

        return $settings;
    }