File
- drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php, line 367
Class
- TraceableEventDispatcher
- Collects some data about event listeners.
Namespace
Symfony\Component\HttpKernel\Debug
Code
private function preDispatch($eventName, Event $event) {
$this->wrappedListeners[$this->id] = new \SplObjectStorage();
$listeners = $this->dispatcher
->getListeners($eventName);
foreach ($listeners as $listener) {
$this->dispatcher
->removeListener($eventName, $listener);
$wrapped = $this
->wrapListener($eventName, $listener);
$this->wrappedListeners[$this->id][$wrapped] = $listener;
$this->dispatcher
->addListener($eventName, $wrapped);
}
switch ($eventName) {
case KernelEvents::REQUEST:
$this->stopwatch
->openSection();
break;
case KernelEvents::VIEW:
case KernelEvents::RESPONSE:
if ($this->stopwatch
->isStarted('controller')) {
$this->stopwatch
->stop('controller');
}
break;
case KernelEvents::TERMINATE:
$token = $event
->getResponse()->headers
->get('X-Debug-Token');
try {
$this->stopwatch
->openSection($token);
} catch (\LogicException $e) {
}
break;
}
}