The RequestWrapper is responsible for delivering and signing requests.

CloneableInstantiable
Methods
public __construct(array $config = [])
 


    public getCredentialsFetcher()
     
    Gets the credentials fetcher and sets up caching. Precedence is as follows:

    • A user supplied credentials fetcher instance.
    • Credentials created from a keyfile.
    • Application default credentials.
    • Anonymous credentials.
    • return FetchAuthTokenInterface
    public keyFile()
     
    Get the Keyfile.

    • return array
    public scopes()
     
    Get the scopes

    • return array
    public send(Psr\Http\Message\RequestInterface $request, array $options = [])
     
    Deliver the request.

    • return ResponseInterface
    public sendAsync(Psr\Http\Message\RequestInterface $request, array $options = [])
     
    Deliver the request asynchronously.

    • return PromiseInterface<\ResponseInterface>
    • experimental The experimental flag means that while we believe this method or class is ready for use, it may change before release in backwards- incompatible ways. Please use with caution, and test thoroughly when upgrading.
    public setCommonDefaults(array $config)
     
    Sets common defaults between request wrappers.

    • throws InvalidArgumentException
    Methods
    protected getADC()
     
    Returns application default credentials. Abstracted out for unit testing.

    • return FetchAuthTokenInterface
    • throws DomainException
    Properties
    private $accessToken
     


    • var string|null Access token used to sign requests.
    private $asyncHttpHandler
     


    • var callable A handler used to deliver PSR-7 requests asynchronously.
    private $authCache
     


    • var CacheItemPoolInterface A cache used for storing tokens.
    private $authCacheOptions
     


    • var array Cache configuration options.
    private $authHttpHandler
     


    • var callable A handler used to deliver PSR-7 requests specifically for authentication.
    private $calcDelayFunction
     


    • var callable|null Sets the conditions for determining how long to wait between attempts to retry.
    private $componentVersion
     


    • var string|null The current version of the component from which the request originated.
    private $credentialsFetcher
     


    • var FetchAuthTokenInterface|null Fetches credentials.
    private $delayFunction
     


    • var callable Executes a delay.
    private $httpHandler
     


    • var callable A handler used to deliver PSR-7 requests.
    private $httpRetryCodes
     


    • var array
    private $httpRetryMessages
     


    • var array
    private $keyFile
     


    • var array The contents of the service account credentials .json file retrieved from the Google Developers Console.
    private $requestTimeout
     


    • var float Seconds to wait before timing out the request. **Defaults to** `0` with REST and `60` with gRPC.
    private $restOptions
     


    • var array HTTP client specific configuration options.
    private $retries
     


    • var int Number of retries for a failed request. **Defaults to** `3`.
    private $retryFunction
     


    • var callable Sets the conditions for whether or not a request should attempt to retry.
    private $scopes
     


    • var array Scopes to be used for the request.
    private $shouldSignRequest
     


    • var bool Whether to enable request signing.
    Methods
    private applyHeaders(Psr\Http\Message\RequestInterface $request)
     
    Applies headers to the request.

    • return RequestInterface
    private buildDefaultAsyncHandler()
     
    Builds the default async HTTP handler.

    • return callable
    private convertToGoogleException(Exception $ex)
     
    Convert any exception to a Google Exception.

    private fetchCredentials()
     
    Fetches credentials.

    • return array
    private getExceptionMessage(Exception $ex)
     
    Gets the exception message.

    • access private
    • return string
    private getRequestOptions(array $options)
     
    Gets a set of request options.

    • return array
    private getRetryFunction( $shouldRetryMessages = true)
     
    Determines whether or not the request should be retried.

    • return callable
    private getRetryOptions(array $options)
     
    Gets a set of retry options.

    • return array
    private getToken()
     
    Gets the access token.

    • return string
    private static jsonDecode( $json, $assoc = false, $depth = 512, $options = 0)
     


    • return mixed
    • throws InvalidArgumentException
    private static jsonEncode( $value, $options = 0, $depth = 512)
     


    • return string
    • throws InvalidArgumentException
    private setHttpRetryCodes(array $codes)
     


      private setHttpRetryMessages(array $messages)
       


        Methods
        private static jsonDecode( $json, $assoc = false, $depth = 512, $options = 0)
         


        • return mixed
        • throws InvalidArgumentException
        private static jsonEncode( $value, $options = 0, $depth = 512)
         


        • return string
        • throws InvalidArgumentException
        © 2020 Bruce Wells
        Search Namespaces \ Classes
        ConfigurationNumbers (0-9.) only