\Nano4\UtilsJSONRPC

Namespaces

Client

Traits

Server A simple JSON-RPC server framework.

Classes

Client A simple JSON-RPC client.
ClientResponse A response from a JSON-RPC server.
Exception A generic extension to Exception, and the parent of all below classes.
InternalError Internal JSON-RPC error.
InvalidParams Invalid method parameter(s).
InvalidRequest The JSON sent is not a valid Request object.
MethodNotFound The method does not exist / is not available.
ParseError Invalid JSON was received by the server.
ServerError
ServerResponse

Functions

DEBUG()

DEBUG(  $message) 

Parameters

$message

EXCEPT()

EXCEPT(  $message) 

Parameters

$message

get_named_param()

get_named_param(Mixed  $params, String  $name, Mixed  $default = null) : Mixed

A helper function to get a named parameter.

Parameters

Mixed $params

The array or object with named parameters.

String $name

The name of the parameter to look for.

Mixed $default

The default value if it's not found.

Returns

Mixed —

The parameter value.

A common use for this is if you want to support both positional and named parameters from the same call. This only works if the first parameter is never an array or object.

public function mymethod ($param1, $param2=null, $param3=null) { $param2 = get_named_param($param1, 'param2', $param2); $param3 = get_named_param($param1, 'param3', $param3); $param1 = get_named_param($param1, 'param1', $param1); // the rest of the function here. }