You are here

protected function Request::assertValidRequest in JSON-RPC 2.x

Same name and namespace in other branches
  1. 8 src/Object/Request.php \Drupal\jsonrpc\Object\Request::assertValidRequest()

Asserts this is a valid request.

Parameters

string $version: The JSON-RPC version.

string $method: The RPC service method id.

mixed|false $id: A string, number or NULL ID. FALSE for notification requests.

1 call to Request::assertValidRequest()
Request::__construct in src/Object/Request.php
Request constructor.

File

src/Object/Request.php, line 154

Class

Request
Request object to help implement JSON RPC's spec for request objects.

Namespace

Drupal\jsonrpc\Object

Code

protected function assertValidRequest($version, $method, $id) {
  assert($version === "2.0", 'A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".');
  assert(strpos($method, 'rpc.') !== 0, 'Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.');
  assert($id === FALSE || is_string($id) || is_numeric($id) || is_null($id), 'An identifier established by the Client that MUST contain a String, Number, or NULL value if included.');
}