You are here

protected function TraceableEventDispatcher::preDispatch in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::preDispatch()
  2. 8 webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::preDispatch()
  3. 8.2 webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::preDispatch()

Called before dispatching the event.

Parameters

string $eventName: The event name.

\Symfony\Component\EventDispatcher\Event $event: The event.

1 call to TraceableEventDispatcher::preDispatch()
TraceableEventDispatcher::dispatch in webprofiler/src/EventDispatcher/TraceableEventDispatcher.php

File

webprofiler/src/EventDispatcher/TraceableEventDispatcher.php, line 128

Class

TraceableEventDispatcher
Class TraceableEventDispatcher.

Namespace

Drupal\webprofiler\EventDispatcher

Code

protected function preDispatch($eventName, Event $event) {
  switch ($eventName) {
    case KernelEvents::VIEW:
    case KernelEvents::RESPONSE:

      // Stop only if a controller has been executed.
      if ($this->stopwatch
        ->isStarted('controller')) {
        $this->stopwatch
          ->stop('controller');
      }
      break;
  }
}