PHP Class Prado\Web\Services\TRpcProtocol

TRpcProtocol is the base class used to implement a protocol in a {@link TRpcService}. Prado already implements two protocols: {@link TXmlRpcProtocol} for Xml-Rpc request and {@link TJsonRpcProtocol} for JSON-Rpc requests.
Since: 3.2
Author: Robin J. Rogge ([email protected])
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Protected Properties

Свойство Type Description
$rpcMethods containing the mapping from RPC method names to the actual handlers

Méthodes publiques

Méthode Description
addMethod ( string $methodName, array $handlerDetails ) Registers a new RPC method and handler details
callApiMethod ( string $methodName, array $parameters ) : mixed Calls the callback handler for the given method
callMethod ( $requestPayload ) : processed
createErrorResponse ( TRpcException $exception ) : a
createResponseHeaders ( $response )
decode ( $data ) : mixed Decodes the request payload
encode ( $data ) : string Encodes the response

Method Details

addMethod() public méthode

Registers a new RPC method and handler details
public addMethod ( string $methodName, array $handlerDetails )
$methodName string
$handlerDetails array containing the callback handler

callApiMethod() public méthode

Calls the callback handler for the given method
public callApiMethod ( string $methodName, array $parameters ) : mixed
$methodName string of the RPC
$parameters array for the callback handler as provided by the client
Résultat mixed whatever the callback handler returns

callMethod() abstract public méthode

abstract public callMethod ( $requestPayload ) : processed
Résultat processed response

createErrorResponse() abstract public méthode

abstract public createErrorResponse ( TRpcException $exception ) : a
$exception TRpcException
Résultat a response representing the error

createResponseHeaders() abstract public méthode

abstract public createResponseHeaders ( $response )

decode() abstract public méthode

Decodes the request payload
abstract public decode ( $data ) : mixed
Résultat mixed decoded request

encode() abstract public méthode

Encodes the response
abstract public encode ( $data ) : string
Résultat string encoded response

Property Details

$rpcMethods protected_oe property

containing the mapping from RPC method names to the actual handlers
protected $rpcMethods