PHP Class Basho\Riak\Api\Http

Inheritance: extends Basho\Riak\Api, implements Basho\Riak\ApiInterface
Show file Open project: basho/riak-php-client

Protected Properties

Property Type Description
$connection null cURL connection handle
$headers
$path string API path
$query string Query string
$requestBody string Request body to be sent
$responseBody string Response body returned from request
$responseHeaders array Response headers returned from request
$statusCode integer HTTP Status Code from response

Public Methods

Method Description
addHeader ( $key, $value ) Add a custom header to the request
closeConnection ( )
getConnection ( ) : resource
getPath ( ) : string
getQuery ( ) : string
getRequest ( ) : string
getResponseBody ( ) : string
getResponseHeaders ( ) : array
getStatusCode ( ) : integer
openConnection ( )
prepare ( Basho\Riak\Command $command, Node $node ) Prepare request to be sent
resetConnection ( )
responseBodyCallback ( $ch, $body ) : integer Response body callback
responseHeaderCallback ( $ch, $header ) : integer Response header callback
send ( ) : boolean

Protected Methods

Method Description
buildPath ( ) Sets the API path for the command
getResponseHeader ( $key, $default = '' )
parseResponse ( )
prepareConnection ( ) Prepare Connection
prepareRequest ( ) Prepare request
prepareRequestData ( ) Prepare request data
prepareRequestHeaders ( ) Prepares the request headers
prepareRequestMethod ( ) Prepare the request method
prepareRequestParameters ( ) Prepare request parameters
prepareRequestUrl ( ) Prepares the complete request URL

Private Methods

Method Description
createIndexQueryPath ( Basho\Riak\Bucket $bucket ) : string Generates the URL path for a 2i Query

Method Details

addHeader() public method

Add a custom header to the request
public addHeader ( $key, $value )
$key
$value

buildPath() protected method

Sets the API path for the command
protected buildPath ( )

closeConnection() public method

public closeConnection ( )

getConnection() public method

public getConnection ( ) : resource
return resource

getPath() public method

public getPath ( ) : string
return string

getQuery() public method

public getQuery ( ) : string
return string

getRequest() public method

public getRequest ( ) : string
return string

getResponseBody() public method

public getResponseBody ( ) : string
return string

getResponseHeader() protected method

protected getResponseHeader ( $key, $default = '' )

getResponseHeaders() public method

public getResponseHeaders ( ) : array
return array

getStatusCode() public method

public getStatusCode ( ) : integer
return integer

openConnection() public method

public openConnection ( )

parseResponse() protected method

protected parseResponse ( )

prepare() public method

Prepare request to be sent
public prepare ( Basho\Riak\Command $command, Node $node )
$command Basho\Riak\Command
$node Basho\Riak\Node

prepareConnection() protected method

Sets general connection options that are used with every request
protected prepareConnection ( )

prepareRequest() protected method

Sets connection options that are specific to this request
protected prepareRequest ( )

prepareRequestData() protected method

Prepare request data
protected prepareRequestData ( )

prepareRequestHeaders() protected method

Prepares the request headers
protected prepareRequestHeaders ( )

prepareRequestMethod() protected method

Prepare the request method
protected prepareRequestMethod ( )

prepareRequestParameters() protected method

Prepare request parameters
protected prepareRequestParameters ( )

prepareRequestUrl() protected method

Prepares the complete request URL
protected prepareRequestUrl ( )

resetConnection() public method

public resetConnection ( )

responseBodyCallback() public method

Handles callback from curl when the response is received, it sets the response body as a member of the class. Has to be public for curl to be able to access it.
public responseBodyCallback ( $ch, $body ) : integer
$ch
$body
return integer

responseHeaderCallback() public method

Handles callback from curl when the response is received, it parses the headers into an array sets them as member of the class. Has to be public for curl to be able to access it.
public responseHeaderCallback ( $ch, $header ) : integer
$ch
$header
return integer

send() public method

public send ( ) : boolean
return boolean

Property Details

$connection protected property

cURL connection handle
protected null $connection
return null

$headers protected property

protected $headers

$path protected property

API path
protected string $path
return string

$query protected property

Query string
protected string $query
return string

$requestBody protected property

Request body to be sent
protected string $requestBody
return string

$responseBody protected property

Response body returned from request
protected string $responseBody
return string

$responseHeaders protected property

Response headers returned from request
protected array $responseHeaders
return array

$statusCode protected property

HTTP Status Code from response
protected int $statusCode
return integer