JSONRPC 1.0.0

Response extends Response
in package
uses SerializerAware, JsonRpcVersionAware

Table of Contents

Properties

$content_type  : mixed
$id  : mixed
$is_from_server  : bool
$jsonrpc_version  : string|null
$serializer  : mixed

Methods

__construct()  : mixed
getCharsetEncoder()  : Charset
Reimplemented to make us use the correct parser type.
getJsonRpcVersion()  : string|null
getSerializer()  : mixed
id()  : mixed
isFromServer()  : bool
serialize()  : string
Returns json representation of the response. Sets `payload` and `content_type` properties.
setIsFromServer()  : void
setJsonRpcVersion()  : void
setSerializer()  : mixed
withId()  : Response
Duplicates a Response, injecting the id
xml_header()  : string
Reimplemented for completeness.

Properties

$content_type

protected mixed $content_type = 'application/json'

$is_from_server

protected bool $is_from_server = false

used to tell apart (error) responses generated by the client / request from the ones received from the server

Methods

__construct()

public __construct(Value|string|mixed $val[, int $fCode = 0 ][, string $fString = '' ][, string $valType = '' ][, mixed $id = null ][, array<string|int, mixed>|null $httpResponse = null ]) : mixed
Parameters
$val : Value|string|mixed

either a Value object, a php value or the json serialization of a json-rpc value (a string). Note that using anything other than a Value object wll have an impact on serialization. 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.

$fCode : int = 0

set it to anything but 0 to create an error response. In that case, $val is discarded

$fString : string = ''

the error string, in case of an error response

$valType : string = ''

The type of $val passed in. Either 'jsonrpcvals', 'phpvals' or 'json'. Leave empty to let the code guess the correct type by looking at $val - in which case strings are assumed to be serialized json

$id : mixed = null
$httpResponse : array<string|int, mixed>|null = null

this should be set when the response is being built out of data received from http (i.e. not when programmatically building a Response server-side). Array keys should include, if known: headers, cookies, raw_data, status_code

getCharsetEncoder()

Reimplemented to make us use the correct parser type.

public getCharsetEncoder() : Charset
Return values
Charset

getJsonRpcVersion()

public getJsonRpcVersion() : string|null
Return values
string|null

NULL means let the global var PhpJsonRpc::$defaultJsonRpcVersion decide

isFromServer()

public isFromServer() : bool
Return values
bool

serialize()

Returns json representation of the response. Sets `payload` and `content_type` properties.

public serialize([string $charsetEncoding = '' ]) : string
Parameters
$charsetEncoding : string = ''

the charset to be used for serialization. if null, US-ASCII is assumed

Return values
string

the json representation of the response

setIsFromServer()

public setIsFromServer(bool $value) : void
Parameters
$value : bool

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

xml_header()

Reimplemented for completeness.

public xml_header([string $charsetEncoding = '' ]) : string
Parameters
$charsetEncoding : string = ''
Return values
string

        
On this page

Search results