src/Biceps/DocumentBundle/Controller/StandardController.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (c) 2022 Biceps
  4.  */
  5. namespace Biceps\DocumentBundle\Controller;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. class StandardController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/", name="default")
  14.      * @Route("/", name="dashboard")
  15.      *
  16.      * @return Response
  17.      */
  18.     public function index(): Response
  19.     {
  20.         return $this->render('@Document/Standard/index.html.twig');
  21.     }
  22.     /**
  23.      * @Route("/ping", name="ping")
  24.      */
  25.     public function ping(): Response
  26.     {
  27.         // Remove profiler for better rendering.
  28.         if ($this->container->has('profiler')) {
  29.             $this->container->get('profiler')->disable();
  30.         }
  31.         $response = new Response();
  32.         $response->headers->addCacheControlDirective('no-cache'true);
  33.         $response->headers->addCacheControlDirective('max-age'0);
  34.         $response->headers->addCacheControlDirective('must-revalidate'true);
  35.         $response->headers->addCacheControlDirective('no-store'true);
  36.         $response->headers->set('Content-Type''text/plain');
  37.         $response->setContent('pong');
  38.         return $response;
  39.     }
  40. }