PHP Class Snorlax\RestResource

Show file Open project: ezdeliveryco/snorlax

Protected Properties

Property Type Description
$client RestClient
$last_response mixed

Public Methods

Method Description
__call ( string $method, array $args ) : StdClass Calls the method contained in the actions of this resource
__construct ( RestClient $client ) Initializes the client
getActions ( ) : array Returns the actions available for this resource
getBaseUri ( ) : string Returns the base URI for every request
getLastResponse ( ) : mixed Returns the last_response of the last executed request

Protected Methods

Method Description
parse ( string $response ) : string Returns the response parsed, by default as a json-decoded StdObject

Private Methods

Method Description
getParams ( array $args ) : array Extracts the params from the arguments passed
getPath ( array $action, array $args ) : mixed Returns the URI path for the request

Method Details

__call() public method

Calls the method contained in the actions of this resource
public __call ( string $method, array $args ) : StdClass
$method string
$args array
return StdClass The JSON decoded response

__construct() public method

Initializes the client
public __construct ( RestClient $client )
$client RestClient

getActions() abstract public method

Returns the actions available for this resource
abstract public getActions ( ) : array
return array

getBaseUri() abstract public method

Returns the base URI for every request
abstract public getBaseUri ( ) : string
return string

getLastResponse() public method

Returns the last_response of the last executed request
public getLastResponse ( ) : mixed
return mixed

parse() protected method

Returns the response parsed, by default as a json-decoded StdObject
protected parse ( string $response ) : string
$response string
return string

Property Details

$client protected property

protected RestClient,snorlax $client
return RestClient

$last_response protected property

protected mixed $last_response
return mixed