class HttpClientManagerFactory in HTTP Client Manager 8.2
Same name and namespace in other branches
- 8 src/HttpClientManagerFactory.php \Drupal\http_client_manager\HttpClientManagerFactory
Class HttpClientManagerFactory.
@package Drupal\http_client_manager
Hierarchy
- class \Drupal\http_client_manager\HttpClientManagerFactory implements HttpClientManagerFactoryInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
Expanded class hierarchy of HttpClientManagerFactory
1 file declares its use of HttpClientManagerFactory
- HttpClientManagerFactoryTest.php in tests/
src/ Unit/ HttpClientManagerFactoryTest.php
1 string reference to 'HttpClientManagerFactory'
1 service uses HttpClientManagerFactory
File
- src/
HttpClientManagerFactory.php, line 12
Namespace
Drupal\http_client_managerView source
class HttpClientManagerFactory implements HttpClientManagerFactoryInterface {
use ContainerAwareTrait;
/**
* An array of HTTP Clients.
*
* @var array
*/
protected $clients = [];
/**
* {@inheritdoc}
*/
public function get($service_api) {
if (!isset($this->clients[$service_api])) {
$apiHandler = $this->container
->get('http_client_manager.http_services_api');
$eventDispatcher = $this->container
->get('event_dispatcher');
$this->clients[$service_api] = new HttpClient($service_api, $apiHandler, $eventDispatcher);
}
return $this->clients[$service_api];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HttpClientManagerFactory:: |
protected | property | An array of HTTP Clients. | |
HttpClientManagerFactory:: |
public | function |
Retrieves the registered http client for the requested service api. Overrides HttpClientManagerFactoryInterface:: |