original_string: public function toolbarAction(Request $request, $token)
      {
          if (null === $this->profiler) {
              throw new NotFoundHttpException('The profiler must be enabled.');
          }
  
          if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
              // keep current flashes for one more request if using AutoExpireFlashBag
              $session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
          }
  
          if ('empty' === $token || null === $token) {
              return new Response('', 200, ['Content-Type' => 'text/html']);
          }
  
          $this->profiler->disable();
  
          if (!$profile = $this->profiler->loadProfile($token)) {
              return new Response('', 404, ['Content-Type' => 'text/html']);
          }
  
          $url = null;
          try {
              $url = $this->generator->generate('_profiler', ['token' => $token]);
          } catch (\Exception $e) {
              // the profiler is not enabled
          }
  
          return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/toolbar.html.twig', [
              'request' => $request,
              'profile' => $profile,
              'templates' => $this->getTemplateManager()->getNames($profile),
              'profiler_url' => $url,
              'token' => $token,
              'profiler_markup_version' => 2, // 1 = original toolbar, 2 = Symfony 2.8+ toolbar
          ]);
      }
code: public function toolbarAction(Request $request, $token)
      {
          if (null === $this->profiler) {
              throw new NotFoundHttpException('The profiler must be enabled.');
          }
  
          if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
              // keep current flashes for one more request if using AutoExpireFlashBag
              $session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
          }
  
          if ('empty' === $token || null === $token) {
              return new Response('', 200, ['Content-Type' => 'text/html']);
          }
  
          $this->profiler->disable();
  
          if (!$profile = $this->profiler->loadProfile($token)) {
              return new Response('', 404, ['Content-Type' => 'text/html']);
          }
  
          $url = null;
          try {
              $url = $this->generator->generate('_profiler', ['token' => $token]);
          } catch (\Exception $e) {
              // the profiler is not enabled
          }
  
          return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/toolbar.html.twig', [
              'request' => $request,
              'profile' => $profile,
              'templates' => $this->getTemplateManager()->getNames($profile),
              'profiler_url' => $url,
              'token' => $token,
              'profiler_markup_version' => 2, // 1 = original toolbar, 2 = Symfony 2.8+ toolbar
          ]);
      }
code_tokens: public function toolbarAction ( Request $ request , $ token ) { if ( null === $ this -> profiler ) { throw new NotFoundHttpException ( 'The profiler must be enabled.' ) ; } if ( $ request -> hasSession ( ) && ( $ session = $ request -> getSession ( ) ) && $ session -> isStarted ( ) && $ session -> getFlashBag ( ) instanceof AutoExpireFlashBag ) { // keep current flashes for one more request if using AutoExpireFlashBag $ session -> getFlashBag ( ) -> setAll ( $ session -> getFlashBag ( ) -> peekAll ( ) ) ; } if ( 'empty' === $ token || null === $ token ) { return new Response ( '' , 200 , [ 'Content-Type' => 'text/html' ] ) ; } $ this -> profiler -> disable ( ) ; if ( ! $ profile = $ this -> profiler -> loadProfile ( $ token ) ) { return new Response ( '' , 404 , [ 'Content-Type' => 'text/html' ] ) ; } $ url = null ; try { $ url = $ this -> generator -> generate ( '_profiler' , [ 'token' => $ token ] ) ; } catch ( \ Exception $ e ) { // the profiler is not enabled } return $ this -> renderWithCspNonces ( $ request , '@WebProfiler/Profiler/toolbar.html.twig' , [ 'request' => $ request , 'profile' => $ profile , 'templates' => $ this -> getTemplateManager ( ) -> getNames ( $ profile ) , 'profiler_url' => $ url , 'token' => $ token , 'profiler_markup_version' => 2 , // 1 = original toolbar, 2 = Symfony 2.8+ toolbar ] ) ; }
docstring: Renders the Web Debug Toolbar.
  
  @param Request $request The current HTTP Request
  @param string  $token   The profiler token
  
  @return Response A Response instance
  
  @throws NotFoundHttpException
docstring_tokens: Renders the Web Debug Toolbar .