Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController::panelAction PHP Method

panelAction() public method

Renders a profiler panel for the given token.
public panelAction ( string $token ) : Response
$token string The profiler token
return Symfony\Component\HttpFoundation\Response A Response instance
    public function panelAction($token)
    {
        $profiler = $this->container->get('profiler');
        $profiler->disable();

        $panel = $this->container->get('request')->query->get('panel', 'request');

        if (!$profile = $profiler->loadProfile($token)) {
            return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound.html.twig', array('token' => $token));
        }

        if (!$profile->hasCollector($panel)) {
            throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token));
        }

        return $this->container->get('templating')->renderResponse($this->getTemplateName($profiler, $panel), array(
            'token'     => $token,
            'profile'   => $profile,
            'collector' => $profile->getCollector($panel),
            'panel'     => $panel,
            'templates' => $this->getTemplates($profiler),
        ));
    }