Implementation of the
Google Cloud Translation REST API.

CloneableInstantiable
ImplementsGoogle\Cloud\Translate\V2\Connection\ConnectionInterface
Constants
public Google\Cloud\Translate\V2\Connection\Rest::BASE_URI = 'https://translation.googleapis.com/language/translate/'
 
  • deprecated
public Google\Cloud\Translate\V2\Connection\Rest::DEFAULT_API_ENDPOINT = 'https://translation.googleapis.com'
Methods
public __construct(array $config = [])
 
    public buildUriWithQuery( $uri, array $query)
     
    • return UriInterface
    public expandUri( $uri, array $variables)
     
    • return string
    • todo look at returning UriInterface
    public listDetections(array $args = [])
     
    • return array
    public listLanguages(array $args = [])
     
    • return array
    public listTranslations(array $args = [])
     
    • return array
    public requestWrapper()
     

    Get the RequestWrapper.

    • return RequestWrapper|null
    public send( $resource, $method, array $options = [], $whitelisted = false)
     

    Delivers a request built from the service definition.

    • return array
    public setRequestBuilder(Google\Cloud\Core\RequestBuilder $requestBuilder)
     

    Sets the request builder.

      public setRequestWrapper(Google\Cloud\Core\RequestWrapper $requestWrapper)
       

      Sets the request wrapper.

        Properties
        private $requestBuilder
         
        • var RequestBuilder Builds PSR7 requests from a service definition.
        private $requestWrapper
         
        • var RequestWrapper Wrapper used to handle sending requests to the JSON API.
        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 getApiEndpoint( $default, array $config)
         

        Return a custom API endpoint in the proper format, or default if none provided.

        • return string
        private isAssoc(array $arr)
         

        Determine whether given array is associative.

        • return bool
        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 modifyWhitelistedError(Google\Cloud\Core\Exception\NotFoundException $e)
         

        Modify the error message of a whitelisted exception.

        • return NotFoundException
        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
        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