Server
extends Server
in package
uses
EncoderAware, SerializerAware
Tags
Table of Contents
Constants
- OPT_DEBUG_FORMAT = 'debug_format'
Properties
- $debug : mixed
- $debug_format : string
- $encoder : mixed
- $functions_parameters_type : mixed
- $is_servicing_multicall : null|false|array<string|int, mixed>
- $is_servicing_notification : null|bool
- $phpvals_encoding_options : array<string|int, mixed>
- $responseClass : mixed
- $serializer : mixed
Methods
- getCapabilities() : array<string|int, array<string|int, mixed>>
- getCharsetEncoder() : Charset
- Reimplemented to make us use the correct parser type.
- getEncoder() : mixed
- getOption() : mixed
- getParser() : Parser
- Reimplemented to make us use the correct parser type.
- getSerializer() : mixed
- methodNameCallback() : void
- parseRequestHeaders() : Response|null
- Parse http headers received along with the json-rpc request. If needed, inflate request.
- serializeDebug() : mixed
- service() : Response|string
- Execute the json-rpc request, printing the response.
- setEncoder() : mixed
- setOption() : mixed
- setSerializer() : mixed
- execute() : Response
- Note: syntax differs from overridden method, by adding msgID and jsonrpcVersion args.
- fixErrorCodeIfNeeded() : void
- generatePayload() : string
- injectDebugInfo() : string
- isSyscall() : bool
- printPayload() : void
- xml_header() : string
- No xml header generated by the server, since we are sending json.
Constants
OPT_DEBUG_FORMAT
public
mixed
OPT_DEBUG_FORMAT
= 'debug_format'
Properties
$debug
protected
mixed
$debug
= 0
$debug_format
protected
string
$debug_format
= 'json5'
either 'json5' or 'extra_member'
$encoder
protected
static mixed
$encoder
$functions_parameters_type
protected
mixed
$functions_parameters_type
= \PhpXmlRpc\JsonRpc\Helper\Parser::RETURN_JSONRPCVALS
$is_servicing_multicall
protected
null|false|array<string|int, mixed>
$is_servicing_multicall
= null
$is_servicing_notification
protected
null|bool
$is_servicing_notification
= null
This is required as checking for NULL resp. Id is not sufficient - it can happen in error cases
$phpvals_encoding_options
protected
array<string|int, mixed>
$phpvals_encoding_options
= array()
Option used for fine-tuning the encoding the php values returned from functions registered in the dispatch map when the functions_parameters_type member is set to 'phpvals'.
Tags
$responseClass
protected
static mixed
$responseClass
= '\PhpXmlRpc\JsonRpc\Response'
$serializer
protected
static mixed
$serializer
Methods
getCapabilities()
public
getCapabilities() : array<string|int, array<string|int, mixed>>
Tags
Return values
array<string|int, array<string|int, mixed>>getCharsetEncoder()
Reimplemented to make us use the correct parser type.
public
getCharsetEncoder() : Charset
Return values
CharsetgetEncoder()
public
getEncoder() : mixed
getOption()
public
getOption(mixed $name) : mixed
Parameters
- $name : mixed
getParser()
Reimplemented to make us use the correct parser type.
public
getParser() : Parser
Return values
ParsergetSerializer()
public
getSerializer() : mixed
methodNameCallback()
public
methodNameCallback(string $methodName, Parser $xmlParser[, null $parser = null ]) : void
Parameters
- $methodName : string
- $xmlParser : Parser
- $parser : null = null
Tags
parseRequestHeaders()
Parse http headers received along with the json-rpc request. If needed, inflate request.
public
parseRequestHeaders(mixed &$data, mixed &$reqEncoding, mixed &$respEncoding, mixed &$respCompression) : Response|null
Parameters
- $data : mixed
- $reqEncoding : mixed
- $respEncoding : mixed
- $respCompression : mixed
Return values
Response|null —null on success or an error Response
serializeDebug()
public
serializeDebug([mixed $charsetEncoding = '' ][, mixed $format = 'comment' ]) : mixed
Parameters
- $charsetEncoding : mixed = ''
- $format : mixed = 'comment'
Tags
service()
Execute the json-rpc request, printing the response.
public
service([string $data = null ][, bool $returnPayload = false ]) : Response|string
Parameters
- $data : string = null
-
the request body. If null, the http POST request will be examined
- $returnPayload : bool = false
-
When true, return the response but do not echo it or any http header
Tags
Return values
Response|string —the response object (usually not used by caller...) or its json serialization
setEncoder()
public
static setEncoder(mixed $encoder) : mixed
Parameters
- $encoder : mixed
setOption()
public
setOption(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
setSerializer()
public
static setSerializer(mixed $serializer) : mixed
Parameters
- $serializer : mixed
execute()
Note: syntax differs from overridden method, by adding msgID and jsonrpcVersion args.
protected
execute(Request|string $req[, null|array<string|int, mixed> $params = null ][, null|array<string|int, string> $paramTypes = null ][, mixed $msgID = null ][, null|string $jsonrpcVersion = null ]) : Response
Parameters
- $req : Request|string
-
either a Request obj or a method name
- $params : null|array<string|int, mixed> = null
-
unlike the parent class, the array can have non-numeric keys
- $paramTypes : null|array<string|int, string> = null
-
array with xml-rpc types of method parameters (only if $req is method name)
- $msgID : mixed = null
-
to be used when $req is a string, or when it is an xml-rpc request instead of a json-rpc one
- $jsonrpcVersion : null|string = null
-
when not set, the version from $req is used (if set), or the default one from PhpJsonRpc
Tags
Return values
ResponsefixErrorCodeIfNeeded()
protected
fixErrorCodeIfNeeded(Response $resp) : void
Parameters
- $resp : Response
generatePayload()
protected
generatePayload(Response $resp, string $respCharset) : string
Parameters
- $resp : Response
- $respCharset : string
Return values
stringinjectDebugInfo()
protected
injectDebugInfo(string $payload, string $respCharset) : string
Parameters
- $payload : string
- $respCharset : string
Return values
stringisSyscall()
protected
isSyscall(string $methName) : bool
Parameters
- $methName : string
Return values
boolprintPayload()
protected
printPayload(string $payload, string $respContentType, string $respEncoding) : void
Parameters
- $payload : string
- $respContentType : string
- $respEncoding : string
xml_header()
No xml header generated by the server, since we are sending json.
protected
xml_header([string $charsetEncoding = '' ]) : string
this method was moved to the Response class
Parameters
- $charsetEncoding : string = ''