public function AcsfEventDispatcher::dispatch in Acquia Cloud Site Factory Connector 8.2
Same name and namespace in other branches
- 8 src/Event/AcsfEventDispatcher.php \Drupal\acsf\Event\AcsfEventDispatcher::dispatch()
Dispatches a list of event handlers.
Parameters
AcsfEvent $event: The AcsfEvent that is being executed.
File
- src/
Event/ AcsfEventDispatcher.php, line 34
Class
- AcsfEventDispatcher
- AcsfEventDispatcher.
Namespace
Drupal\acsf\EventCode
public function dispatch(AcsfEvent $event) {
$this->running = TRUE;
while ($this->running && ($handler = $event
->popHandler('incomplete'))) {
try {
// Capture some information about the handler.
$handler->started = microtime(TRUE);
$handler
->handle();
$handler->completed = microtime(TRUE);
$event
->pushHandler($handler, 'complete');
} catch (\Exception $e) {
$handler->message = sprintf('Class %s handler failed for event %s: %s', get_class($handler), $event->type, $e
->getMessage());
$event
->pushHandler($handler, 'failed');
}
}
}