{@inheritdoc}

@return \Acquia\Network\AcquiaNetworkClient
549620
public static function factory($config = array())
    {

        $defaults = array(
            'base_url'       => 'https://rpc.acquia.com',
            'server_address' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '',
            'http_host'      => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
            'https'          => false,
            'network_id'     => '',
            'network_key'    => '',
        );

        // Instantiate the Acquia Search plugin.
        $config = Collection::fromConfig($config, $defaults);
        return new static(
            $config->get('base_url'),
            $config->get('network_id'),
            $config->get('network_key'),
            $config
        );
    }
851081
public function getOAuth2Client()
    {
        if (!$this->oAuth2Client instanceof OAuth2Client) {
            return new OAuth2Client(
                $this->getApp(),
                $this->getClient(),
                $this->getRandomStringGenerator()
            );
        }

        return $this->oAuth2Client;
    }
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;
    }
717237
public static function getClient($protocol = null)
    {
        $protocol = $protocol ?: self::DEFAULT_PROTOCOL;
        return self::$clients[$protocol];
    }
770648
public static function getHttpClient()
    {
        if(self::$httpClient) {
            return self::$httpClient;
        }
        $client = new Client();
        return self::$httpClient = $client;
    }
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;
    }
1165496
public static function factory($config = array())
    {
        $required = array(
            'base_url',
            'username',
            'password',
        );

        $defaults = array(
            'base_url' => self::BASE_URL,
            'base_path' => self::BASE_PATH,
        );

        // Instantiate the Acquia Search plugin.
        $config = Collection::fromConfig($config, $defaults, $required);
        $client = new static($config->get('base_url'), $config);
        $client->setDefaultHeaders(array(
            'Content-Type' => 'application/json; charset=utf-8',
        ));

        // Attach the Acquia Search plugin to the client.
        $plugin = new CloudApiAuthPlugin($config->get('username'), $config->get('password'));
        $client->addSubscriber($plugin);

        return $client;
    }
38575
public function getClient($locales = array('en'))
    {
        return new Client(
            $this->config['client']['user_id'],
            $this->config['client']['license_key'],
            $locales,
            $this->config['client']['options'] ?: array()
        );
    }
1301523
public function setHttpClient(Client $client = null)
    {
        if ($client === null) {
            $client = new Client(
                HttpClientDiscovery::find(),
                MessageFactoryDiscovery::find()
            );
        }
        $this->client = $client;
        return $this;
    }
932010
protected function client()
    {
        $dsn = $this->config('dsn');
        if (!$dsn) {
            return null;
        }

        $client = new Raven_Client($dsn);
        $callInstall = $this->config('callInstall');
        if ($callInstall === true) {
            $client->install();
        }

        return $client;
    }
700094
public function client()
    {
        $query = $this->pdo->prepare(<<<SQL
SELECT
  content,
  statusCode,
  nextUpdate,
  effective,
  worker,
  UNIX_TIMESTAMP()
FROM robotstxt__cache1
WHERE base = :base;
SQL
        );
        $query->bindValue('base', $this->base, \PDO::PARAM_STR);
        $query->execute();
        if ($query->rowCount() > 0) {
            $row = $query->fetch(\PDO::FETCH_ASSOC);
            $this->clockSyncCheck($row['UNIX_TIMESTAMP()'], self::OUT_OF_SYNC_TIME_LIMIT);
            if ($row['nextUpdate'] >= $row['UNIX_TIMESTAMP()']) {
                $this->markAsActive($row['worker']);
                return new TxtClient($this->base, $row['statusCode'], $row['content'], self::ENCODING, $row['effective'], $this->byteLimit);
            }
        }
        $query = $this->pdo->prepare(<<<SQL
UPDATE robotstxt__cache1
SET worker = 0
WHERE base = :base;
SQL
        );
        $query->bindValue('base', $this->base, \PDO::PARAM_STR);
        $query->execute();
        return $this->refresh();
    }
1344296
public function gearmanClient()
    {
        $client = new GearmanClient();

        $servers = static::_getGearmanServers();

        $client->addServers(implode(',', $servers));

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

        return new Client($options);
    }
412272
protected function client()
    {
        $projectId = $this->config('projectId');
        $projectKey = $this->config('projectKey');
        if (!$projectId || !$projectKey) {
            return null;
        }

        $config = $this->config();
        $client = new Notifier($config);

        return $client;
    }
794907
public function client($client = null)
    {
        if ($client === null) {
            return $this->getClient();
        }

        return $this->setClient($client);
    }
296352
public function getAuthenticationClient()
    {
        if (null === $this->authenticationClient) {
            $this->authenticationClient = new Auth\OAuth2(
                $this->getHttpClient(),
                $this->getOption('client_id'),
                $this->getOption('client_secret')
            );
        }

        return $this->authenticationClient;
    }
802898
public function getGuzzle()
    {

        if ($this->guzzle)
            return $this->guzzle;

        $this->guzzle = new Client();

        return $this->guzzle;

    }