[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Remote/ -> JsonRpcServer.php (summary)

(no description)

File Size: 188 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JsonRpcServer:: (6 methods):
  __construct()
  serve()
  createResponse()
  returnError()
  addErrorData()
  call()


Class: JsonRpcServer  - X-Ref

Provide the Remote XMLRPC API as a JSON based API

__construct()   X-Ref
JsonRpcServer constructor.


serve($body = '')   X-Ref
Serve the request

return: mixed
param: string $body Should only be set for testing, otherwise the request body is read from php://input

createResponse($data)   X-Ref
This executes the method and returns the result

This should handle all JSON-RPC versions and our simplified version

return: array
param: array $data
link: https://en.wikipedia.org/wiki/JSON-RPC
link: https://www.jsonrpc.org/specification

returnError($exception)   X-Ref
Create an error response

return: array
param: \Exception $exception

addErrorData(&$response, $e = null)   X-Ref
Depending on the requested version, add error data to the response

return: void
param: array $response
param: \Exception|null $e

call($methodname, $args)   X-Ref
Call an API method

return: mixed
param: string $methodname
param: array $args