You are here

protected function Handler::getExecutable in JSON-RPC 8

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

Gets an executable instance of an RPC method.

Parameters

\Drupal\jsonrpc\MethodInterface $method: The method definition.

array $configuration: Method configuration.

Return value

object The executable method.

Throws

\Drupal\jsonrpc\Exception\JsonRpcException In case of error.

1 call to Handler::getExecutable()
Handler::doExecution in src/Handler.php
Gets an anonymous function which executes the RPC method.

File

src/Handler.php, line 171

Class

Handler
Manages all the JSON-RPC business logic.

Namespace

Drupal\jsonrpc

Code

protected function getExecutable(MethodInterface $method, array $configuration) {
  try {
    return $this->methodManager
      ->createInstance($method
      ->id(), $configuration);
  } catch (PluginException $e) {
    throw JsonRpcException::fromError(Error::methodNotFound($method
      ->id()));
  }
}