You are here

protected function TraceableEventDispatcher::preDispatch in Devel 8.2

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. 4.x webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::preDispatch()

Called before dispatching the event.

Parameters

string $eventName The event name:

Event $event The event:

1 call to TraceableEventDispatcher::preDispatch()
TraceableEventDispatcher::dispatch in webprofiler/src/EventDispatcher/TraceableEventDispatcher.php
Dispatches an event to all registered listeners.

File

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

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;
  }
}