private function setClientOptions(array $options)
    {
        $this->validateNotNull($options, [
            'serviceAddress',
            'serviceName',
            'descriptorsConfigPath',
            'clientConfig',
            'disableRetries',
            'credentialsConfig',
            'transportConfig',
        ]);
        $this->validate($options, [
            'credentials',
            'transport',
            'gapicVersion',
            'libName',
            'libVersion',
        ]);

        $clientConfig = $options['clientConfig'];
        if (is_string($clientConfig)) {
            $clientConfig = json_decode(file_get_contents($clientConfig), true);
        }
        $this->serviceName = $options['serviceName'];
        $this->retrySettings = RetrySettings::load(
            $this->serviceName,
            $clientConfig,
            $options['disableRetries']
        );
        $this->agentHeader = AgentHeader::buildAgentHeader(
            $this->pluckArray([
                'libName',
                'libVersion',
                'gapicVersion'
            ], $options)
        );
        self::validateFileExists($options['descriptorsConfigPath']);
        $descriptors = require($options['descriptorsConfigPath']);
        $this->descriptors = $descriptors['interfaces'][$this->serviceName];

        $this->credentialsWrapper = $this->createCredentialsWrapper(
            $options['credentials'],
            $options['credentialsConfig']
        );

        $transport = $options['transport'] ?: self::defaultTransport();
        $this->transport = $transport instanceof TransportInterface
            ? $transport
            : $this->createTransport($options['serviceAddress'], $transport, $options['transportConfig']);
    }
private function setClientOptions(array $options)
    {
        $this->validateNotNull($options, [
            'serviceAddress',
            'serviceName',
            'descriptorsConfigPath',
            'clientConfig',
            'disableRetries',
            'credentialsConfig',
            'transportConfig',
        ]);
        $this->validate($options, [
            'credentials',
            'transport',
            'gapicVersion',
            'libName',
            'libVersion',
        ]);

        $clientConfig = $options['clientConfig'];
        if (is_string($clientConfig)) {
            $clientConfig = json_decode(file_get_contents($clientConfig), true);
        }
        $this->serviceName = $options['serviceName'];
        $this->retrySettings = RetrySettings::load(
            $this->serviceName,
            $clientConfig,
            $options['disableRetries']
        );
        $this->agentHeader = AgentHeader::buildAgentHeader(
            $this->pluckArray([
                'libName',
                'libVersion',
                'gapicVersion'
            ], $options)
        );
        self::validateFileExists($options['descriptorsConfigPath']);
        $descriptors = require($options['descriptorsConfigPath']);
        $this->descriptors = $descriptors['interfaces'][$this->serviceName];

        $this->credentialsWrapper = $this->createCredentialsWrapper(
            $options['credentials'],
            $options['credentialsConfig']
        );

        $transport = $options['transport'] ?: self::defaultTransport();
        $this->transport = $transport instanceof TransportInterface
            ? $transport
            : $this->createTransport($options['serviceAddress'], $transport, $options['transportConfig']);
    }
private function setClientOptions ( array $ options ) { $ this -> validateNotNull ( $ options , [ 'serviceAddress' , 'serviceName' , 'descriptorsConfigPath' , 'clientConfig' , 'disableRetries' , 'credentialsConfig' , 'transportConfig' , ] ) ; $ this -> validate ( $ options , [ 'credentials' , 'transport' , 'gapicVersion' , 'libName' , 'libVersion' , ] ) ; $ clientConfig = $ options [ 'clientConfig' ] ; if ( is_string ( $ clientConfig ) ) { $ clientConfig = json_decode ( file_get_contents ( $ clientConfig ) , true ) ; } $ this -> serviceName = $ options [ 'serviceName' ] ; $ this -> retrySettings = RetrySettings :: load ( $ this -> serviceName , $ clientConfig , $ options [ 'disableRetries' ] ) ; $ this -> agentHeader = AgentHeader :: buildAgentHeader ( $ this -> pluckArray ( [ 'libName' , 'libVersion' , 'gapicVersion' ] , $ options ) ) ; self :: validateFileExists ( $ options [ 'descriptorsConfigPath' ] ) ; $ descriptors = require ( $ options [ 'descriptorsConfigPath' ] ) ; $ this -> descriptors = $ descriptors [ 'interfaces' ] [ $ this -> serviceName ] ; $ this -> credentialsWrapper = $ this -> createCredentialsWrapper ( $ options [ 'credentials' ] , $ options [ 'credentialsConfig' ] ) ; $ transport = $ options [ 'transport' ] ? : self :: defaultTransport ( ) ; $ this -> transport = $ transport instanceof TransportInterface ? $ transport : $ this -> createTransport ( $ options [ 'serviceAddress' ] , $ transport , $ options [ 'transportConfig' ] ) ; }
Configures the GAPIC client based on an array of options.

@param array $options {
An array of required and optional arguments.

@type string $serviceAddress
The address of the API remote host, for example "example.googleapis.com. May also
include the port, for example "example.googleapis.com:443"
@type bool $disableRetries
Determines whether or not retries defined by the client configuration should be
disabled. Defaults to `false`.
@type string|array $clientConfig
Client method configuration, including retry settings. This option can be either a
path to a JSON file, or a PHP array containing the decoded JSON data.
By default this settings points to the default client config file, which is provided
in the resources folder.
@type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
The credentials to be used by the client to authorize API calls. This option
accepts either a path to a credentials file, or a decoded credentials file as a
PHP array.
*Advanced usage*: In addition, this option can also accept a pre-constructed
\Google\Auth\FetchAuthTokenInterface object or \Google\ApiCore\CredentialsWrapper
object. Note that when one of these objects are provided, any settings in
$authConfig will be ignored.
@type array $credentialsConfig
Options used to configure credentials, including auth token caching, for the client.
For a full list of supporting configuration options, see
\Google\ApiCore\CredentialsWrapper::build.
@type string|TransportInterface $transport
The transport used for executing network requests. May be either the string `rest`,
`grpc`, or 'grpc-fallback'. Defaults to `grpc` if gRPC support is detected on the system.
*Advanced usage*: Additionally, it is possible to pass in an already instantiated
TransportInterface object. Note that when this objects is provided, any settings in
$transportConfig, and any $serviceAddress setting, will be ignored.
@type array $transportConfig
Configuration options that will be used to construct the transport. Options for
each supported transport type should be passed in a key for that transport. For
example:
$transportConfig = [
'grpc' => [...],
'rest' => [...],
'grpc-fallback' => [...],
];
See the GrpcTransport::build and RestTransport::build
methods for the supported options.
@type string $versionFile
The path to a file which contains the current version of the client.
@type string $descriptorsConfigPath
The path to a descriptor configuration file.
@type string $serviceName
The name of the service.
@type string $libName
The name of the client application.
@type string $libVersion
The version of the client application.
@type string $gapicVersion
The code generator version of the GAPIC library.
}
@throws ValidationException
Configures the GAPIC client based on an array of options .