JsonRpcMethodBase.php in JSON-RPC 8
File
src/Plugin/JsonRpcMethodBase.php
View source
<?php
namespace Drupal\jsonrpc\Plugin;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\jsonrpc\ExecutableWithParamsInterface;
use Drupal\jsonrpc\HandlerInterface;
use Drupal\jsonrpc\MethodInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class JsonRpcMethodBase extends PluginBase implements ContainerFactoryPluginInterface, ExecutableWithParamsInterface {
private $rpcRequest;
public function __construct(array $configuration, string $plugin_id, MethodInterface $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->rpcRequest = $configuration[HandlerInterface::JSONRPC_REQUEST_KEY];
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition);
}
protected function currentRequest() {
return $this->rpcRequest;
}
protected function methodDefinition() {
return $this
->getPluginDefinition();
}
public static abstract function outputSchema();
}