JsonRpcResponse
class JsonRpcResponse implements Arrayable
Methods
__construct(array $content = [])
Create a JSON-RPC response.
static JsonRpcResponse
result(int|string $id, array $result)
Create a result response.
static JsonRpcResponse
notification(string $method, array $params)
Create a notification response.
static JsonRpcResponse
error(string|int|null $id, int $code, string $message, mixed $data = null)
Create an error response.
array
toArray()
Convert the response to an array.
string
toJson(int $options = 0)
Encode the response as JSON, replacing invalid text bytes.
Details
at line 19
__construct(array $content = [])
Create a JSON-RPC response.
at line 28
static JsonRpcResponse
result(int|string $id, array $result)
Create a result response.
at line 41
static JsonRpcResponse
notification(string $method, array $params)
Create a notification response.
at line 52
static JsonRpcResponse
error(string|int|null $id, int $code, string $message, mixed $data = null)
Create an error response.
at line 74
array
toArray()
Convert the response to an array.
at line 85
string
toJson(int $options = 0)
Encode the response as JSON, replacing invalid text bytes.