class TraceableEventDispatcher extends BaseTraceableEventDispatcher
{ /**
* @return void
*/
protected function beforeDispatch(string
$eventName, object
$event) { switch ($eventName) { case KernelEvents::REQUEST:
$event->
getRequest()->attributes->
set('_stopwatch_token',
substr(hash('sha256',
uniqid(mt_rand(), true
)), 0, 6
));
$this->stopwatch->
openSection();
break;
case KernelEvents::VIEW:
case KernelEvents::RESPONSE:
// stop only if a controller has been executed
if ($this->stopwatch->
isStarted('controller'
)) { $this->stopwatch->
stop('controller'
);
} break;
case KernelEvents::TERMINATE:
$sectionId =
$event->
getRequest()->attributes->
get('_stopwatch_token'
);
if (null ===
$sectionId) {