Utils

Utils

category

Basho

author

Riak team (https://github.com/basho/riak-php-client/contributors)

Methods

Fetch a value from an array by it's key, or default if not exists

get_value(mixed $key, array $array, mixed $defaultValue) : mixed
static

Arguments

$key

mixed

Key to fetch

$array

array

Array to fetch from

$defaultValue

mixed

Default to return if not exists

Response

mixed

Construct REST URLs

buildRestPath($client, \Basho\Riak\Bucket $bucket = NULL, string $key = NULL, string $spec = NULL, string $params = NULL) : string
static

Given a Client, Bucket, Key, LinkSpec, and Params, construct and return a URL.

Arguments

$client

$key

string

$spec

string

$params

string

Array of key-value param pairs

Response

string

Construct secondary index URLs

buildIndexPath(\Basho\Riak\Riak $client, \Basho\Riak\Bucket $bucket, string $index, string|int $start, string|int $end = NULL) : string
static

Given a Client, Bucket, Key, LinkSpec, and Params, construct and return a URL for searching secondary indexes.

author

Eric Stevens estevens@taglabsinc.com

Arguments

$index

string

  • Index Name & type (eg, "indexName_bin")

$start

string|int

  • Starting value or exact match if no ending value

$end

string|int

  • Ending value for range search

Response

string

URL

Send HTTP request

httpRequest($method, $url, $request_headers = array(), $obj = '') : array
static

Given a Method, URL, Headers, and Body, perform and HTTP request, and return an array of arity 2 containing an associative array of response headers and the response body.

Arguments

$method

$url

$request_headers

$obj

Response

array

Parse HTTP headers

parseHttpHeaders($headers) : array
static

Parse an HTTP Header string into an asssociative array of response headers.

Arguments

$headers

Response

array