You are here

protected function RpcRequestFactory::denormalizeRequest in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x src/Shaper/RpcRequestFactory.php \Drupal\jsonrpc\Shaper\RpcRequestFactory::denormalizeRequest()

Denormalizes a single JSON-RPC request object.

Parameters

object $data: The decoded JSON-RPC request to be denormalized.

\Shaper\Util\Context $context: The denormalized JSON-RPC request.

Return value

\Drupal\jsonrpc\Object\Request The JSON-RPC request.

Throws

\Drupal\jsonrpc\Exception\JsonRpcException

1 call to RpcRequestFactory::denormalizeRequest()
RpcRequestFactory::doTransform in src/Shaper/RpcRequestFactory.php

File

src/Shaper/RpcRequestFactory.php, line 105

Class

RpcRequestFactory
Creates RPC Request objects.

Namespace

Drupal\jsonrpc\Shaper

Code

protected function denormalizeRequest($data, Context $context) {
  $id = isset($data['id']) ? $data['id'] : FALSE;
  $context[static::REQUEST_ID_KEY] = $id;
  $context[static::REQUEST_VERSION_KEY] = $this->handler
    ->supportedVersion();
  $batch = $context[static::REQUEST_IS_BATCH_REQUEST];
  $params = $this
    ->denormalizeParams($data, $context);
  return new Request($data['jsonrpc'], $data['method'], $batch, $id, $params);
}