You are here

public function Handler::batch in JSON-RPC 2.x

Same name and namespace in other branches
  1. 8 src/Handler.php \Drupal\jsonrpc\Handler::batch()

Executes a batch of remote procedure calls.

Parameters

\Drupal\jsonrpc\Object\Request[] $requests: The JSON-RPC requests.

Return value

array The JSON-RPC responses, if any. Notifications are not returned.

Throws

\Drupal\jsonrpc\Exception\JsonRpcException

Overrides HandlerInterface::batch

File

src/Handler.php, line 67

Class

Handler
Manages all the JSON-RPC business logic.

Namespace

Drupal\jsonrpc

Code

public function batch(array $requests) {
  return array_filter(array_map(function (Request $request) {
    return $this
      ->doRequest($request);
  }, $requests));
}