class HttpClientManagerEventSubscriber in HTTP Client Manager 8
Class HttpClientManagerEventSubscriber.
@package Drupal\conftool
Hierarchy
- class \Drupal\http_client_manager\EventSubscriber\HttpClientManagerEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of HttpClientManagerEventSubscriber
1 string reference to 'HttpClientManagerEventSubscriber'
1 service uses HttpClientManagerEventSubscriber
File
- src/
EventSubscriber/ HttpClientManagerEventSubscriber.php, line 15
Namespace
Drupal\http_client_manager\EventSubscriberView source
class HttpClientManagerEventSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
return [
'command.before_prepare' => array(
'onCommandBeforePrepare',
-9000,
),
];
}
/**
* Command before-prepare event handler
*
* @param \Guzzle\Common\Event $event
* Event received
*/
public function onCommandBeforePrepare(Event $event) {
/** @var OperationCommand $command */
$command = $event['command'];
$description = $command
->getClient()
->getDescription();
$command
->set(OperationCommand::HEADERS_OPTION, [
HttpClientInterface::HEADER_API => $description
->getName(),
HttpClientInterface::HEADER_COMMAND => $command
->getName(),
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HttpClientManagerEventSubscriber:: |
static | function | ||
HttpClientManagerEventSubscriber:: |
public | function | Command before-prepare event handler |