PHP Class Jyxo\Rpc\Client

Author: Jaroslav HanslĂ­k
Datei anzeigen Open project: jyxo/php Class Usage Examples

Protected Properties

Property Type Description
$options array Parameters for creating RPC requests.
$timeout integer Time limit for communication with RPC server (seconds).
$url string Server address.

Public Methods

Method Description
__construct ( string $url = '' ) Creates client instance and eventually sets server address.
disableProfiler ( ) : self Turns request profiler off.
enableProfiler ( ) : self Turns request profiler on.
getCurlOption ( string $key = '' ) : mixed Returns certain curl_setopt parameter or whole array of parameters if no parameter name is provided.
getOption ( string $key = '' ) : mixed Returns certain parameter or whole array of parameters if no parameter name is provided.
send ( string $method, array $params ) : mixed Sends a request and fetches a response from the server.
setCurlOption ( string $key, mixed $value ) : self Changes curl_setopt settings.
setOption ( string $key, mixed $value ) : self Changes client settings.
setTimeout ( integer $timeout ) : self Sets timeout.
setUrl ( string $url ) : self Sets server address.

Protected Methods

Method Description
process ( string $contentType, string $data ) : string Processes request data and fetches response.
profileEnd ( string $type, string $method, array $params, mixed $response ) : self Finishes profiling.
profileStart ( ) : self Starts profiling.

Method Details

__construct() public method

Creates client instance and eventually sets server address.
public __construct ( string $url = '' )
$url string Server address

disableProfiler() public method

Turns request profiler off.
public disableProfiler ( ) : self
return self

enableProfiler() public method

Turns request profiler on.
public enableProfiler ( ) : self
return self

getCurlOption() public method

Returns certain curl_setopt parameter or whole array of parameters if no parameter name is provided.
public getCurlOption ( string $key = '' ) : mixed
$key string Parameter name
return mixed

getOption() public method

Returns certain parameter or whole array of parameters if no parameter name is provided.
public getOption ( string $key = '' ) : mixed
$key string Parameter name
return mixed

process() protected method

Processes request data and fetches response.
protected process ( string $contentType, string $data ) : string
$contentType string Request content-type
$data string Request data
return string

profileEnd() protected method

Finishes profiling.
protected profileEnd ( string $type, string $method, array $params, mixed $response ) : self
$type string Request type
$method string Method name
$params array Method parameters
$response mixed Server response
return self

profileStart() protected method

Starts profiling.
protected profileStart ( ) : self
return self

send() abstract public method

Sends a request and fetches a response from the server.
abstract public send ( string $method, array $params ) : mixed
$method string Method name
$params array Method parameters
return mixed

setCurlOption() public method

Changes curl_setopt settings.
public setCurlOption ( string $key, mixed $value ) : self
$key string Parameter name
$value mixed Parameter value
return self

setOption() public method

Changes client settings.
public setOption ( string $key, mixed $value ) : self
$key string Parameter name
$value mixed Parameter value
return self

setTimeout() public method

Sets timeout.
public setTimeout ( integer $timeout ) : self
$timeout integer Call timeout
return self

setUrl() public method

Sets server address.
public setUrl ( string $url ) : self
$url string Server address
return self

Property Details

$options protected_oe property

Parameters for creating RPC requests.
protected array $options
return array

$timeout protected_oe property

Time limit for communication with RPC server (seconds).
protected int $timeout
return integer

$url protected_oe property

Server address.
protected string $url
return string