Provides shared functionality for gRPC service implementations.

Trait
Methods
public requestWrapper()
 
Get the GrpcRequestWrapper.

  • return GrpcRequestWrapper|null
public send(callable $request, array $args, $whitelisted = false)
 
Delivers a request.

  • return Generator|array
public setRequestWrapper(Google\Cloud\Core\GrpcRequestWrapper $requestWrapper)
 
Sets the request wrapper.

    Methods
    protected constructGapic( $gapicName, array $config)
     
    Construct a gapic client. Allows for tests to intercept.

    • return mixed
    Properties
    private $requestWrapper
     


    Methods
    private arrayFilterRemoveNull(array $arr)
     
    Just like array_filter(), but preserves falsey values except null.

    • return array
    private arrayMergeRecursive(array $array1, array $array2)
     
    A method, similar to PHP's `array_merge_recursive`, with two differences.

    1. Keys in $array2 take precedence over keys in $array1.
    2. Non-array keys found in both inputs are not transformed into an array
      and appended. Rather, the value in $array2 is used.
    • return array
    private convertFractionToNanoSeconds( $subseconds)
     
    Convert subseconds, expressed as a decimal to nanoseconds.

    • return int
    private convertNanoSecondsToFraction( $nanos, $rpad = true)
     
    Convert nanoseconds to subseconds.

    Note that result should be used as a fraction of one second, but is
    given as an integer.

    • return string
    private createDateTimeFromSeconds( $seconds)
     
    Create a DateTimeImmutable instance from a UNIX timestamp (i.e. seconds since epoch).

    • return DateTimeImmutable
    private flattenListValue(array $value)
    private flattenStruct(array $struct)
    private flattenValue(array $value)
    private formatListForApi(array $list)
     
    Format a list for the API.

    • return array
    private formatStructForApi(array $fields)
     
    Format a struct for the API.

    • return array
    private formatTimeAsArray(DateTimeInterface $dateTime, $ns)
     
    Format a timestamp for the API with nanosecond precision.

    • return array
    private formatTimeAsString(DateTimeInterface $dateTime, $ns)
     
    Create a Timestamp string in an API-compatible format.

    • return string
    private formatTimestampForApi( $value)
     
    Format a timestamp for the API with nanosecond precision.

    • return array
    private formatTimestampFromApi(array $timestamp)
     
    Format a gRPC timestamp to match the format returned by the REST API.

    • return string
    private formatValueForApi( $value)
     
    Format a value for the API.

    • return array
    private getGaxConfig( $version, ?callable $authHttpHandler = NULL)
     
    Gets the default configuration for generated clients.

    • return array
    private isAssoc(array $arr)
     
    Determine whether given array is associative.

    • return bool
    private modifyWhitelistedError(Google\Cloud\Core\Exception\NotFoundException $e)
     
    Modify the error message of a whitelisted exception.

    • return NotFoundException
    private parseTimeString( $timestamp)
     
    Parse a Timestamp string and return a DateTimeImmutable instance and nanoseconds as an integer.

    • return array [\DateTimeImmutable, int]
    • throws Exception If the timestamp string is in an unrecognized format.
    private pluck( $key, array $arr, $isRequired = true)
     
    Pluck a value out of an array.

    • return mixed
    • throws InvalidArgumentException
    private pluckArray(array $keys, $arr)
     
    Pluck a subset of an array.

    • return array
    private unpackStructFromApi(array $struct)
    private unpackValue( $value)
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only