PHP Класс 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.
С версии: 3.2
Автор: Robin J. Rogge ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$rpcMethods containing the mapping from RPC method names to the actual handlers

Открытые методы

Метод Описание
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

Описание методов

addMethod() публичный Метод

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

callApiMethod() публичный Метод

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
Результат mixed whatever the callback handler returns

callMethod() абстрактный публичный Метод

abstract public callMethod ( $requestPayload ) : processed
Результат processed response

createErrorResponse() абстрактный публичный Метод

abstract public createErrorResponse ( TRpcException $exception ) : a
$exception TRpcException
Результат a response representing the error

createResponseHeaders() абстрактный публичный Метод

abstract public createResponseHeaders ( $response )

decode() абстрактный публичный Метод

Decodes the request payload
abstract public decode ( $data ) : mixed
Результат mixed decoded request

encode() абстрактный публичный Метод

Encodes the response
abstract public encode ( $data ) : string
Результат string encoded response

Описание свойств

$rpcMethods защищенное свойство

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