function 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

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