Notification
extends Request
in package
Table of Contents
Properties
- $content_type : mixed
- $currentIdCounter : mixed
- $currentIdPrefix : mixed
- $id : mixed
- $jsonrpc_version : string|null
- $paramnames : array<string|int, string>
- $serializer : mixed
Methods
- __construct() : mixed
- The constructor does not take a jsonRpcVersion arg, as this is a json-Rpc 2.0 notification.
- addParam() : bool
- getCharsetEncoder() : Charset
- Reimplemented to make us use the correct parser type.
- getJsonRpcVersion() : string|null
- getParamName() : string
- getParser() : Parser
- Reimplemented to make us use the correct parser type.
- getSerializer() : mixed
- id() : mixed
- parseResponse() : Response|true
- Parse the json-rpc response contained in the string $data and return a Response object.
- setJsonRpcVersion() : void
- setSerializer() : mixed
- generateId() : null
Properties
$content_type
protected
mixed
$content_type
= 'application/json'
$currentIdCounter
protected
static mixed
$currentIdCounter
= 1
$currentIdPrefix
protected
static mixed
$currentIdPrefix
= ''
$id
protected
mixed
$id
= null
$jsonrpc_version
protected
string|null
$jsonrpc_version
$paramnames
protected
array<string|int, string>
$paramnames
= array()
$serializer
protected
static mixed
$serializer
Methods
__construct()
The constructor does not take a jsonRpcVersion arg, as this is a json-Rpc 2.0 notification.
public
__construct(string $methodName[, mixed $params = array() ]) : mixed
Parameters
- $methodName : string
- $params : mixed = array()
-
array of parameters to be passed to the method (Value objects). For json-rpc 2.0 calls, the array keys should either be all consecutive integers starting at 0, or be all strings, in which case the named-parameters calling convention will be used instead of the positional parameters one. For json-rpc 1.0 calls, the array keys get discarded, as only positional params are supported by the protocol. Note that \PhpXmlRpc\Value of type DateTime and Base64 will be serialized as json strings, but not decoded into the correct type at the receiving end.
addParam()
public
addParam(mixed $param[, string|null $name = null ]) : bool
Parameters
- $param : mixed
- $name : string|null = null
-
Either all params should have a name, or none of them
Return values
boolgetCharsetEncoder()
Reimplemented to make us use the correct parser type.
public
getCharsetEncoder() : Charset
Return values
CharsetgetJsonRpcVersion()
public
getJsonRpcVersion() : string|null
Return values
string|null —NULL means let the global var PhpJsonRpc::$defaultJsonRpcVersion decide
getParamName()
public
getParamName(int $i) : string
Parameters
- $i : int
Return values
string —A string is returned, as long as only string keys are used in the constructor and addParam calls. Does not check if the index is oyt of bounds.
getParser()
Reimplemented to make us use the correct parser type.
public
getParser() : Parser
Return values
ParsergetSerializer()
public
getSerializer() : mixed
id()
public
id() : mixed
parseResponse()
Parse the json-rpc response contained in the string $data and return a Response object.
public
parseResponse([string $data = '' ][, bool $headersProcessed = false ][, string $returnType = Parser::RETURN_JSONRPCVALS ]) : Response|true
Parameters
- $data : string = ''
-
the json-rpc response, possibly including http headers
- $headersProcessed : bool = false
-
when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
- $returnType : string = Parser::RETURN_JSONRPCVALS
-
decides return type, i.e. content of response->value(). Either 'jsonrpcvals', 'json' or 'phpvals'
Tags
Return values
Response|true —true when notifications are sent (and the server returns an http response with no body)
setJsonRpcVersion()
public
setJsonRpcVersion(string|null $jsonrpcVersion) : void
Parameters
- $jsonrpcVersion : string|null
-
Use NULL to let the global var PhpJsonRpc::$defaultJsonRpcVersion decide
setSerializer()
public
static setSerializer(mixed $serializer) : mixed
Parameters
- $serializer : mixed
generateId()
protected
generateId() : null