publicfunctiontoolbarAction(Request $request, string $token = null): Response { if(null === $this->profiler){ thrownewNotFoundHttpException('The profiler must be enabled.'); }
if(!$request->attributes->getBoolean('_stateless') && $request->hasSession() &&($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag ){ // keep current flashes for one more request if using AutoExpireFlashBag
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll()); }
// do not capture redirects or modify XML HTTP Requests
if($request->isXmlHttpRequest()){ return; }
if($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects && 'html' === $request->getRequestFormat()){ if($request->hasSession()&&($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag){ // keep current flashes for one more request if using AutoExpireFlashBag
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll()); }