protected function JsonRpcMethodManager::assertValidJsonRpcMethodPlugin in JSON-RPC 8
Same name and namespace in other branches
- 2.x src/Plugin/JsonRpcMethodManager.php \Drupal\jsonrpc\Plugin\JsonRpcMethodManager::assertValidJsonRpcMethodPlugin()
Asserts that the plugin class is valid.
Parameters
\Drupal\jsonrpc\MethodInterface $method: The JSON-RPC method definition.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
1 call to JsonRpcMethodManager::assertValidJsonRpcMethodPlugin()
- JsonRpcMethodManager::alterDefinitions in src/
Plugin/ JsonRpcMethodManager.php - Invokes the hook to alter the definitions if the alter hook is set.
File
- src/
Plugin/ JsonRpcMethodManager.php, line 61
Class
- JsonRpcMethodManager
- Provides the JsonRpcMethod plugin plugin manager.
Namespace
Drupal\jsonrpc\PluginCode
protected function assertValidJsonRpcMethodPlugin(MethodInterface $method) {
foreach ($method->params as $param) {
if (!$param->factory && !$param->schema) {
throw new InvalidPluginDefinitionException($method
->id(), "Every JsonRpcParameterDefinition must define either a factory or a schema.");
}
if ($param->factory && !is_subclass_of($param->factory, ParameterFactoryInterface::class)) {
throw new InvalidPluginDefinitionException($method
->id(), "Parameter factories must implement ParameterFactoryInterface.");
}
}
}