loadProfile example


        if (null === $this->profiler) {
            throw new NotFoundHttpException('The profiler must be enabled.');
        }

        $this->profiler->disable();

        if (null === $this->matcher || null === $this->routes) {
            return new Response('The Router is not enabled.', 200, ['Content-Type' => 'text/html']);
        }

        $profile = $this->profiler->loadProfile($token);

        /** @var RequestDataCollector $request */
        $request = $profile->getCollector('request');

        return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', [
            'request' => $request,
            'router' => $profile->getCollector('router'),
            'traces' => $this->getTraces($request$profile->getMethod()),
        ]), 200, ['Content-Type' => 'text/html']);
    }

    
$this->denyAccessIfProfilerDisabled();

        $this->cspHandler?->disableCsp();

        $panel = $request->query->get('panel');
        $page = $request->query->get('page', 'home');

        if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) {
            $token = $latest['token'];
        }

        if (!$profile = $this->profiler->loadProfile($token)) {
            return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/info.html.twig', ['about' => 'no_token', 'token' => $token, 'request' => $request]);
        }

        if (null === $panel) {
            $panel = 'request';

            foreach ($profile->getCollectors() as $collector) {
                if ($collector instanceof ExceptionDataCollector && $collector->hasException()) {
                    $panel = $collector->getName();

                    break;
                }


    /** * Loads the Profile for the given Response. */
    public function loadProfileFromResponse(Response $response): ?Profile
    {
        if (!$token = $response->headers->get('X-Debug-Token')) {
            return null;
        }

        return $this->loadProfile($token);
    }

    /** * Loads the Profile for the given token. */
    public function loadProfile(string $token): ?Profile
    {
        return $this->storage->read($token);
    }

    /** * Saves a Profile. */


    /** * Renders the exception panel stacktrace for the given token. */
    public function body(string $token): Response
    {
        if (null === $this->profiler) {
            throw new NotFoundHttpException('The profiler must be enabled.');
        }

        $exception = $this->profiler->loadProfile($token)
            ->getCollector('exception')
            ->getException()
        ;

        return new Response($this->errorRenderer->getBody($exception), 200, ['Content-Type' => 'text/html']);
    }

    /** * Renders the exception panel stylesheet. */
    public function stylesheet(): Response
    {
 {
    }

    public function explainAction(
        string $profilerToken,
        string $panelName,
        string $connectionName,
        int $queryIndex
    ): Response {
        $this->profiler->disable();

        $profile = $this->profiler->loadProfile($profilerToken);

        if (!$profile) {
            return new Response('This profile does not exist.');
        }

        try {
            $collector = $profile->getCollector($panelName);
        } catch (\InvalidArgumentException) {
            return new Response('This collector does not exist.');
        }

        


    /** * Loads the Profile for the given Response. */
    public function loadProfileFromResponse(Response $response): ?Profile
    {
        if (!$token = $response->headers->get('X-Debug-Token')) {
            return null;
        }

        return $this->loadProfile($token);
    }

    /** * Loads the Profile for the given token. */
    public function loadProfile(string $token): ?Profile
    {
        return $this->storage->read($token);
    }

    /** * Saves a Profile. */
Home | Imprint | This part of the site doesn't use cookies.