PHP Class Phue\Transport\Http

Inheritance: implements Phue\Transport\TransportInterface
Show file Open project: sqmk/phue

Public Properties

Property Type Description
$exceptionMap array Exception map

Protected Properties

Property Type Description
$adapter Phue\Transport\Adapter\AdapterInterface Adapter
$client Phue\Client Phue Client

Public Methods

Method Description
__construct ( Client $client ) Construct Http transport
getAdapter ( ) : Phue\Transport\Adapter\AdapterInterface Get adapter for transport
getExceptionByType ( string $type, string $description ) : Exception Get exception by type
sendRequest ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : string Send request
sendRequestBypassBodyValidation ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : string Send request, bypass body validation
setAdapter ( Phue\Transport\Adapter\AdapterInterface $adapter ) : self Set adapter

Protected Methods

Method Description
getJsonResponse ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : stdClass Send request

Method Details

__construct() public method

Construct Http transport
public __construct ( Client $client )
$client Phue\Client

getAdapter() public method

Auto created adapter if one is not present
public getAdapter ( ) : Phue\Transport\Adapter\AdapterInterface
return Phue\Transport\Adapter\AdapterInterface Adapter

getExceptionByType() public method

Get exception by type
public getExceptionByType ( string $type, string $description ) : Exception
$type string Error type
$description string Description of error
return Exception Built exception

getJsonResponse() protected method

Send request
protected getJsonResponse ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : stdClass
$address string API address
$method string Request method
$body stdClass Post body
return stdClass Json body

sendRequest() public method

Send request
public sendRequest ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : string
$address string API address
$method string Request method
$body stdClass Post body
return string Request response

sendRequestBypassBodyValidation() public method

Send request, bypass body validation
public sendRequestBypassBodyValidation ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : string
$address string API address
$method string Request method
$body stdClass Post body
return string Request response

setAdapter() public method

Set adapter
public setAdapter ( Phue\Transport\Adapter\AdapterInterface $adapter ) : self
$adapter Phue\Transport\Adapter\AdapterInterface Transport adapter
return self This object

Property Details

$adapter protected property

Adapter
protected AdapterInterface,Phue\Transport\Adapter $adapter
return Phue\Transport\Adapter\AdapterInterface

$client protected property

Phue Client
protected Client,Phue $client
return Phue\Client

$exceptionMap public static property

Exception map
public static array $exceptionMap
return array