Copied!

Builds a PSR-7 request from a set of request information.

  • internal
CloneableInstantiable
Methods
public __construct(string $baseUri, string $restConfigPath)
 
  • param string $baseUri
  • param string $restConfigPath
  • throws \ValidationException
public build(string $path, Google\Protobuf\Internal\Message $message, array $headers = [])
 
  • param string $path
  • param \Message $message
  • param array $headers
  • return \RequestInterface
  • throws \ValidationException
public buildUriWithQuery( $uri, array $query)
 
  • param string|\UriInterface $uri
  • param array $query
  • return \UriInterface
public pathExists(string $path)
 
  • param string $path
  • return bool
public static validate(array $arr, array $requiredKeys)
 
  • param array $arr Associative array
  • param array $requiredKeys List of keys to check for in $arr
  • return array Returns $arr for fluent use
public static validateNotNull(array $arr, array $requiredKeys)
 
  • param array $arr Associative array
  • param array $requiredKeys List of keys to check for in $arr
  • return array Returns $arr for fluent use
Properties
protected $baseUri = NULL
Methods
protected buildUri(string $path, array $queryParams)
 
  • param string $path
  • param array $queryParams
  • return \UriInterface
Properties
private $restConfig = NULL
Methods
private arrayFilterRemoveNull(array $arr)
 

Just like array_filter(), but preserves falsey values except null.

  • param array $arr
  • 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.
  • param array $array1
  • param array $array2
  • return array
private buildBindings(array $placeholders, Google\Protobuf\Internal\Message $message)
 
  • param array $placeholders
  • param \Message $message
  • return array Bindings from path template fields to values from message
private constructBodyAndQueryParameters(Google\Protobuf\Internal\Message $message, array $config)
 
  • param \Message $message
  • param array $config
  • return array Tuple [$body, $queryParams]
private getConfigsForUriTemplates(array $config)
 

Create a list of all possible configs using the additionalBindings

  • param array $config
  • return array[] An array of configs
private isAssoc(array $arr)
 

Determine whether given array is associative.

  • param array $arr
  • return bool
private pluck(string $key, array $arr, bool $isRequired = true)
 

Pluck a value out of an array.

  • param string $key
  • param array $arr
  • param bool $isRequired
  • return mixed|null
  • throws \InvalidArgumentException
private pluckArray(array $keys, array $arr)
 

Pluck a subset of an array.

  • param array $keys
  • param array $arr
  • return array
private subsetArray(array $keys, array $arr)
 

Return a subset of an array, like pluckArray, without modifying the original array.

  • param array $keys
  • param array $arr
  • return array
private tryRenderPathTemplate(string $uriTemplate, array $bindings)
 

Try to render the resource name. The rendered resource name will always contain a leading '/'

  • param string $uriTemplate
  • param array $bindings
  • return null|string
  • throws \ValidationException
private static validateFileExists(string $filePath)
 
  • param string $filePath
  • throws \ValidationException
private static validateImpl( $arr, $requiredKeys, $allowNull)
Methods
public static validate(array $arr, array $requiredKeys)
 
  • param array $arr Associative array
  • param array $requiredKeys List of keys to check for in $arr
  • return array Returns $arr for fluent use
private static validateFileExists(string $filePath)
 
  • param string $filePath
  • throws \ValidationException
private static validateImpl( $arr, $requiredKeys, $allowNull)
public static validateNotNull(array $arr, array $requiredKeys)
 
  • param array $arr Associative array
  • param array $requiredKeys List of keys to check for in $arr
  • return array Returns $arr for fluent use
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration