Method to return a new Client object, auto-configured
with the proper hostname.

@return mixed Client object on success, FALSE on failure.
773757
public function newEWS()
    {
        // Discovery not yet attempted.
        if ($this->discovered === null) {
            $this->discover();
        }

        // Discovery not successful.
        if ($this->discovered === false) {
            return false;
        }

        $server = false;
        $version = null;

        // Pick out the host from the EXPR (Exchange RPC over HTTP).
        foreach ($this->discovered['Account']['Protocol'] as $protocol) {
            if (($protocol['Type'] == 'EXCH' || $protocol['Type'] == 'EXPR')
                && isset($protocol['ServerVersion'])) {
                if ($version === null) {
                    $sv = $this->parseServerVersion($protocol['ServerVersion']);
                    if ($sv !== false) {
                        $version = $sv;
                    }
                }
            }

            if ($protocol['Type'] == 'EXPR' && isset($protocol['Server'])) {
                $server = $protocol['Server'];
            }
        }

        if ($server) {
            if ($version === null) {
                // EWS class default.
                $version = Client::VERSION_2007;
            }
            return new Client(
                $server,
                (!empty($this->username) ? $this->username : $this->email),
                $this->password,
                $version
            );
        }

        return false;
    }
863913
public function getClient()
    {
        $options = [
            'base_uri' => $this->base_url . 'rest/api/',
            'auth' => [$this->user, $this->pass],
        ];

        return new Client($options);
    }
852577
private function getClient() {
        $login = $this->getParam('login');
        $passwordHash = $this->getParam('passwd_hash');
        $token = $this->getParam('token');

        if (empty($token) && (empty($login) || empty($passwordHash))) {
            throw new ConfigurationException(__CLASS__ . ' is not configured properly. Please set "token" or "login" and "passwd_pash" parameters properly.');
        }

        $client = null;
        if (!empty($token)) {
            $client = Client::createFromToken($token);
        }
        else {
            $client = new Client($login);
            $client->setPasswordHash($passwordHash);
        }
        return $client;
    }
340662
protected function createClient()
	{
		$resource = Route::input( 'resource' );
		$related = Route::input( 'related', Input::get( 'related' ) );

		$aimeos = app( 'aimeos' )->get();
		$tmplPaths = $aimeos->getCustomPaths( 'client/jsonapi/templates' );

		$context = app( 'aimeos.context' )->get();
		$langid = $context->getLocale()->getLanguageId();

		$context->setView( app( 'aimeos.view' )->create( $context, $tmplPaths, $langid ) );

		return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related );
	}
1064743
public function getClient()
    {
        if (null === $this->client) {
            $this->client = S3Client::factory([
                'version'   => 'latest',
                'region'    => $this->getRegion()
            ]);
        }
        return $this->client;
    }
502087
private function initClient() {
		if(isset($_COOKIE[self::CLIENT_INFO_COOKIE])) {
			$clientData = @json_decode(base64_decode($_COOKIE[self::CLIENT_INFO_COOKIE], true), true);
			if(!$clientData) {
				throw new \Exception('Wrong format of response cookie data: ' . $_COOKIE[self::CLIENT_INFO_COOKIE]);
			}

			$client = new Client($clientData);
			if(isset($clientData['auth'])) {
				$client->auth = new ClientAuth($clientData['auth']);
			}
			return $client;
		}
	}
866239
public function getSessionClient()
    {
        if (is_null($this->sessionClient)) {
            $this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
        }

        return $this->sessionClient;
    }
735033
protected function getClient()
    {
        $retries   = 5;
        $httpCodes = null;
        $curlCodes = null;

        $plugin = BackoffPlugin::getExponentialBackoff($retries, $httpCodes, $curlCodes);
        $client = new Client($this->baseUrl);
        $client->addSubscriber($plugin);

        return $client;
    }
739200
function getClient($clientName)
    {
        if (! isset($this->clients[$clientName]) )
            // if not client constructed look for lazy options:
            $this->clients[$clientName] = $this->_attainClient($clientName);


        return $this->clients[$clientName];
    }
1064020
public function client($name = null)
    {
        if (is_null($name)) {
            $name = $this->getDefaultName();
        }

        if (! isset($this->clients[$name])) {
            $this->clients[$name] = new Client(
                $this->getWebhookForClient($name),
                $this->getMessageDefaultsForClient($name),
                $this->getHttpClientForClient($name)
            );
        }

        return $this->clients[$name];
    }
384485
public function createClientUrl($client)
    {
        $this->autoRender = false;
        $url = $this->getBaseAuthUrl();
        $url[$this->clientIdGetParamName] = $client->getId();

        return Url::to($url);
    }
474902
public function getClient()
    {
        $client = $this->reduceFirst(function (SearchProviderInterface $provider) {
            return $provider->getClient();
        });

        if (null === $client) {
            throw new \RuntimeException('No provider was able to return a client');
        }

        return $client;
    }
851862
public function getClient()
    {
        if ( $this->client ) {
            return $this->client;
        }

        $this->client = new Client(self::BASE_URL);

        return $this->client;
    }
527588
def getclient():
        '''
        
        '''
        if not Configuration.client_initialized:
            Configuration._initconf()
            Configuration.client_settings = Configuration.settings['client']
            Configuration.client_initialized = True
        return Configuration.client_settings
1366238
protected function recreateClient()
    {
        $entryUrl = $this->config['entryUrl'];
        $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
        $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);

        $this->client = new Yii2Connector([
            'SCRIPT_FILENAME' => $entryFile,
            'SCRIPT_NAME' => $entryScript,
            'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST),
            'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80',
            'HTTPS' => parse_url($entryUrl, PHP_URL_SCHEME) === 'https'
        ]);

        $this->configureClient($this->config);
    }
76184
public function getHttpClient() {
    if ($this->httpClient === NULL) {
      $this->httpClient = new HttpClient($this->options);
    }

    return $this->httpClient;
  }
158150
protected function createClient()
    {
        /** @var SSLCertificate $credentials */
        $credentials         = $this->getCredentials();
        $url                 = $this->getServiceURL();
        $transport           = !empty($url['transport']) ? $url['transport'] : self::SECURE_TRANSPORT_DEFAULT;

        $this->serviceClient = new SocketClient($url['host'], $url['port']);
        $this->serviceClient
            ->setTransport($transport)
            ->setContextOptions(array(
                'local_cert' => $credentials->getCertificate(),
                'passphrase' => $credentials->getCertificatePassPhrase(),
            ))
            ->addConnectionFlag(STREAM_CLIENT_PERSISTENT)
            ->setBlockingMode(false)
        ;

        return $this;
    }