You are here

public function HttpServiceApiWrapperFactory::get in HTTP Client Manager 8.2

Get HTTP Service API wrapper.

Parameters

string $name: The HTTP Service API wrapper name.

Return value

\Drupal\http_client_manager\Plugin\HttpServiceApiWrapper\HttpServiceApiWrapperInterface An HTTP Service API Wrapper Service.

Throws

\InvalidArgumentException Throws an InvalidArgumentException if the provided name does not exists.

Overrides HttpServiceApiWrapperFactoryInterface::get

File

src/HttpServiceApiWrapperFactory.php, line 38

Class

HttpServiceApiWrapperFactory
Class HttpServiceApiWrapperFactory.

Namespace

Drupal\http_client_manager

Code

public function get($name) {
  if (!isset($this->apiWrappers[$name])) {
    $message = sprintf('Cannot find an api wrapper with the name "%s', $name);
    throw new \InvalidArgumentException($message);
  }
  return $this->apiWrappers[$name];
}