You are here

protected function TraceableEventDispatcher::postDispatch in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php \Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher::postDispatch()
  2. 8 vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php \Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher::postDispatch()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php \Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher::postDispatch()

Called after dispatching the event.

Parameters

string $eventName The event name:

Event $event The event:

Overrides TraceableEventDispatcher::postDispatch

File

vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php, line 78

Class

TraceableEventDispatcher
Collects some data about event listeners.

Namespace

Symfony\Component\HttpKernel\Debug

Code

protected function postDispatch($eventName, Event $event) {
  switch ($eventName) {
    case KernelEvents::CONTROLLER:
      $this->stopwatch
        ->start('controller', 'section');
      break;
    case KernelEvents::RESPONSE:
      $token = $event
        ->getResponse()->headers
        ->get('X-Debug-Token');
      $this->stopwatch
        ->stopSection($token);
      break;
    case KernelEvents::TERMINATE:

      // In the special case described in the `preDispatch` method above, the `$token` section
      // does not exist, then closing it throws an exception which must be caught.
      $token = $event
        ->getResponse()->headers
        ->get('X-Debug-Token');
      try {
        $this->stopwatch
          ->stopSection($token);
      } catch (\LogicException $e) {
      }
      break;
  }
}