<?php
/**
* @author Antony Tkachenko <at@canaryknight.ru>
*/
namespace App\Controller;
use App\Helper\LastModifyHelper;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route;
class MobileAppController extends AbstractController
{
private LastModifyHelper $tracker;
public function __construct(KernelInterface $appKernel)
{
$this->tracker = new LastModifyHelper($appKernel);
}
/**
* @Route("/mobile-app", name="mobile_app_index.ru", methods={"GET"})
*/
public function index(): Response
{
$template = 'mobile-app/index.html.twig';
$modified = $this->tracker->get($template);
$response = $this->render($template, ['modified' => $modified]);
$response->headers->set('Last-Modified', $modified);
return $response;
}
}