class RpcMethod (View source)

RPC Method object

It create a method's object ready to inject into RpcServer.

Constants

FETCH_ASSOC

FETCH_NUMERIC

Properties

static array $rpcvalues Generic-to-RPC values map

Methods

__construct($name, callable $callback, ...$arguments)

Class constructor

string
getName()

Get the method's name

callable
getCallback()

Get the method's callback

setDescription(string $description = null)

Set the method's description

string|null
getDescription()

Get the method's method

array
getArguments()

Get additional arguments to forward to callback

addSignature()

Add a signature and switch internal pointer

array
getSignatures(bool $compact = true)

Get the method's signatures

array
getSignature(bool $compact = true)

Get the current method's signature

bool
deleteSignature(integer $signature)

Delete a signature

selectSignature(integer $signature)

Select a signature

setReturnType(string $type)

Set the current signature's return type

string
getReturnType()

Get the current signature's return type

addParameter(string $type, string $name)

Add a parameter to current signature

deleteParameter(string $name)

Delete a parameter from current signature

array
getParameters(string $format = self::FETCH_ASSOC)

Get current signature's parameters

static RpcMethod
create($name, callable $callback, ...$arguments)

Static class constructor - create an RpcMethod object

Details

__construct($name, callable $callback, ...$arguments)

Class constructor

Parameters

$name
callable $callback
...$arguments

Exceptions

InvalidArgumentException

string getName()

Get the method's name

Return Value

string

callable getCallback()

Get the method's callback

Return Value

callable

RpcMethod setDescription(string $description = null)

Set the method's description

Parameters

string $description

Return Value

RpcMethod

Exceptions

InvalidArgumentException

string|null getDescription()

Get the method's method

Return Value

string|null

array getArguments()

Get additional arguments to forward to callback

Return Value

array

RpcMethod addSignature()

Add a signature and switch internal pointer

Return Value

RpcMethod

array getSignatures(bool $compact = true)

Get the method's signatures

Parameters

bool $compact (default) Compact signatures in a format compatible with system.methodSignature

Return Value

array

array getSignature(bool $compact = true)

Get the current method's signature

Parameters

bool $compact (default) Compact signatures in a format compatible with system.methodSignature

Return Value

array

bool deleteSignature(integer $signature)

Delete a signature

Parameters

integer $signature The signature's ID

Return Value

bool

Exceptions

InvalidArgumentException

RpcMethod selectSignature(integer $signature)

Select a signature

Parameters

integer $signature The signature's ID

Return Value

RpcMethod

Exceptions

Exception

RpcMethod setReturnType(string $type)

Set the current signature's return type

Parameters

string $type

Return Value

RpcMethod

Exceptions

InvalidArgumentException

string getReturnType()

Get the current signature's return type

Return Value

string

RpcMethod addParameter(string $type, string $name)

Add a parameter to current signature

Parameters

string $type
string $name

Return Value

RpcMethod

Exceptions

InvalidArgumentException

RpcMethod deleteParameter(string $name)

Delete a parameter from current signature

Parameters

string $name

Return Value

RpcMethod

Exceptions

Exception

array getParameters(string $format = self::FETCH_ASSOC)

Get current signature's parameters

Parameters

string $format The output array format (ASSOC|NUMERIC)

Return Value

array

static RpcMethod create($name, callable $callback, ...$arguments)

Static class constructor - create an RpcMethod object

Parameters

$name
callable $callback
...$arguments

Return Value

RpcMethod

Exceptions

Exception