You are here

public function TraceableEventDispatcher::dispatch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php \Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher::dispatch()

Dispatches an event to all registered listeners.

Parameters

string $eventName The name of the event to dispatch. The name of: the event is the name of the method that is invoked on listeners.

Event $event The event to pass to the event handlers/listeners.: If not supplied, an empty Event instance is created.

Return value

Event

Overrides EventDispatcherInterface::dispatch

File

vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php, line 113

Class

TraceableEventDispatcher
Collects some data about event listeners.

Namespace

Symfony\Component\EventDispatcher\Debug

Code

public function dispatch($eventName, Event $event = null) {
  if (null === $event) {
    $event = new Event();
  }
  $this
    ->preProcess($eventName);
  $this
    ->preDispatch($eventName, $event);
  $e = $this->stopwatch
    ->start($eventName, 'section');
  $this->dispatcher
    ->dispatch($eventName, $event);
  if ($e
    ->isStarted()) {
    $e
      ->stop();
  }
  $this
    ->postDispatch($eventName, $event);
  $this
    ->postProcess($eventName);
  return $event;
}