fromArray($options); } /** * Sets the array of options as class properites. * * @param array $arr See the constructor for the list of supported options. */ private function fromArray(array $arr) : void { $this->setHeaders($arr['headers'] ?? []); $this->setTimeoutMillis($arr['timeoutMillis'] ?? null); $this->setTransportOptions($arr['transportOptions'] ?? []); $this->setRetrySettings($arr['retrySettings'] ?? null); } /** * @param array $headers */ public function setHeaders(array $headers) { $this->headers = $headers; } /** * @param int|null $timeoutMillis */ public function setTimeoutMillis(?int $timeoutMillis) { $this->timeoutMillis = $timeoutMillis; } /** * @param array $transportOptions { * Transport-specific call-time options. * * @type array $grpcOptions * Key-value pairs for gRPC-specific options passed as the `$options` argument to {@see \Grpc\BaseStub} * request methods. Current options are `call_credentials_callback` and `timeout`. * **NOTE**: This library sets `call_credentials_callback` using {@see CredentialsWrapper}, and `timeout` * using the `timeoutMillis` call option, so these options are not very useful. * @type array $grpcFallbackOptions * Key-value pairs for gRPC fallback specific options passed as the `$options` argument to the * `$httpHandler` callable. By default these are passed to {@see \GuzzleHttp\Client} as request options. * See {@link https://docs.guzzlephp.org/en/stable/request-options.html}. * @type array $restOptions * Key-value pairs for REST-specific options passed as the `$options` argument to the `$httpHandler` * callable. By default these are passed to {@see \GuzzleHttp\Client} as request options. * See {@link https://docs.guzzlephp.org/en/stable/request-options.html}. * } */ public function setTransportOptions(array $transportOptions) { $this->transportOptions = $transportOptions; } /** * @deprecated use CallOptions::setTransportOptions */ public function setTransportSpecificOptions(array $transportSpecificOptions) { $this->setTransportOptions($transportSpecificOptions); } /** * @param RetrySettings|array|null $retrySettings */ public function setRetrySettings($retrySettings) { $this->retrySettings = $retrySettings; } }