class HttpServiceApiWrapperFactory in HTTP Client Manager 8.2
Class HttpServiceApiWrapperFactory.
@package Drupal\http_client_manager
Hierarchy
- class \Drupal\http_client_manager\HttpServiceApiWrapperFactory implements HttpServiceApiWrapperFactoryInterface
Expanded class hierarchy of HttpServiceApiWrapperFactory
1 string reference to 'HttpServiceApiWrapperFactory'
1 service uses HttpServiceApiWrapperFactory
File
- src/
HttpServiceApiWrapperFactory.php, line 12
Namespace
Drupal\http_client_managerView source
class HttpServiceApiWrapperFactory implements HttpServiceApiWrapperFactoryInterface {
/**
* An array of HTTP Service Api Wrapper Services.
*
* @var \Drupal\http_client_manager\Plugin\HttpServiceApiWrapper\HttpServiceApiWrapperInterface[]
*/
protected $apiWrappers;
/**
* HttpServiceApiWrapperFactory constructor.
*/
public function __construct() {
$this->apiWrappers = [];
}
/**
* {@inheritdoc}
*/
public function addApiWrapper(HttpServiceApiWrapperInterface $wrapper, $api) {
$this->apiWrappers[$api] = $wrapper;
}
/**
* {@inheritdoc}
*/
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];
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HttpServiceApiWrapperFactory:: |
protected | property | An array of HTTP Service Api Wrapper Services. | |
HttpServiceApiWrapperFactory:: |
public | function |
Add an HTTP Service API wrapper. Overrides HttpServiceApiWrapperFactoryInterface:: |
|
HttpServiceApiWrapperFactory:: |
public | function |
Get HTTP Service API wrapper. Overrides HttpServiceApiWrapperFactoryInterface:: |
|
HttpServiceApiWrapperFactory:: |
public | function | HttpServiceApiWrapperFactory constructor. |