You are here

protected function DiscoveryController::getAvailableMethods in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x modules/jsonrpc_discovery/src/Controller/DiscoveryController.php \Drupal\jsonrpc_discovery\Controller\DiscoveryController::getAvailableMethods()

Gets all accessible methods for the RPC handler.

Parameters

\Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability: The cacheability information for the current request.

Return value

\Drupal\jsonrpc\MethodInterface[] The methods.

2 calls to DiscoveryController::getAvailableMethods()
DiscoveryController::method in modules/jsonrpc_discovery/src/Controller/DiscoveryController.php
Information about the method.
DiscoveryController::methods in modules/jsonrpc_discovery/src/Controller/DiscoveryController.php
List the available methods.

File

modules/jsonrpc_discovery/src/Controller/DiscoveryController.php, line 103

Class

DiscoveryController
The controller that responds with the discovery information.

Namespace

Drupal\jsonrpc_discovery\Controller

Code

protected function getAvailableMethods(RefinableCacheableDependencyInterface $cacheability) {
  return array_filter($this->handler
    ->supportedMethods(), function (MethodInterface $method) use ($cacheability) {
    $access_result = $method
      ->access('view', NULL, TRUE);
    $cacheability
      ->addCacheableDependency($access_result);
    return $access_result
      ->isAllowed();
  });
}