You are here

public function HttpClient::getCommands in HTTP Client Manager 8.2

Same name and namespace in other branches
  1. 8 src/HttpClient.php \Drupal\http_client_manager\HttpClient::getCommands()

Get service api commands.

Return value

mixed The service api commands.

Overrides HttpClientInterface::getCommands

File

src/HttpClient.php, line 324

Class

HttpClient
The http client.

Namespace

Drupal\http_client_manager

Code

public function getCommands() {
  if (!empty($this->commands)) {
    return $this->commands;
  }
  $description = $this
    ->getClient()
    ->getDescription();
  $command_names = array_keys($description
    ->getOperations());
  $this->commands = [];
  foreach ($command_names as $command_name) {
    $this->commands[$command_name] = $description
      ->getOperation($command_name);
  }
  return $this->commands;
}