class HttpClientManagerFactory in HTTP Client Manager 8
Same name and namespace in other branches
- 8.2 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 = array();
/**
* {@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:: |