src/Controller/WalletController.php line 30

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Antony Tkachenko <at@canaryknight.ru>
  4.  */
  5. namespace App\Controller;
  6. use App\Helper\LastModifyHelper;
  7. use App\Services\WalletRedirect\WalletRedirectService;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\HttpKernel\KernelInterface;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. class WalletController extends AbstractController
  13. {
  14.     private WalletRedirectService $walletRedirectService;
  15.     private LastModifyHelper $tracker;
  16.     public function __construct(WalletRedirectService $walletRedirectServiceKernelInterface $appKernel)
  17.     {
  18.         $this->walletRedirectService $walletRedirectService;
  19.         $this->tracker = new LastModifyHelper($appKernel);
  20.     }
  21.     /**
  22.      * @Route("/wallet", name="wallet_index", methods={"GET"})
  23.      */
  24.     public function index()
  25.     {
  26.         $redirectRoute $this->walletRedirectService->getWalletRouteName();
  27.         if ($redirectRoute){
  28.             return $this->redirectToRoute($redirectRoute);
  29.         }
  30.         $template 'wallet/index.html.twig';
  31.         $modified $this->tracker->get($template);
  32.         $response $this->render($template, ['modified' => $modified]);
  33.         $response->headers->set('Last-Modified'$modified);
  34.         return $response;
  35.     }
  36.     /**
  37.      * @Route("/wallet/otkritie", name="wallet_otkritie", methods={"GET"})
  38.      */
  39.     public function otkritie(): Response
  40.     {
  41.         // Временное скрытие страницы.
  42.         throw $this->createNotFoundException();
  43.         $this->walletRedirectService->setSource(WalletRedirectService::SOURCE_OPEN_BANK);
  44.         return $this->render('wallet/otkritie/index.html.twig', ['modified' => $this->tracker->get('wallet/otkritie/index.html.twig')]);
  45.     }
  46.     /**
  47.      * @Route("/wallet/otkritie/tariff", name="wallet_otkritie_tariff", methods={"GET"})
  48.      */
  49.     public function otkritieTariff(): Response
  50.     {
  51.         // Временное скрытие страницы.
  52.         throw $this->createNotFoundException();
  53.         return $this->render('wallet/otkritie/tariff.html.twig', ['modified' => $this->tracker->get('wallet/otkritie/tariff.html.twig')]);
  54.     }
  55.     /**
  56.      * @Route("/wallet/gpb", name="wallet_gpb", methods={"GET"})
  57.      */
  58.     public function gpb(): Response
  59.     {
  60.         $this->walletRedirectService->setSource(WalletRedirectService::SOURCE_GPB);
  61.         $template 'wallet/gpb/index.html.twig';
  62.         $modified $this->tracker->get($template);
  63.         $response $this->render('wallet/gpb/index.html.twig', ['modified' => $modified]);
  64.         $response->headers->set('Last-Modified'$modified);
  65.         return $response;
  66.     }
  67.     /**
  68.      * @Route("/wallet/gpb/tariff", name="wallet_gpb_tariff", methods={"GET"})
  69.      */
  70.     public function gpbTariff(): Response
  71.     {
  72.         $this->walletRedirectService->setSource(WalletRedirectService::SOURCE_GPB);
  73.         $template 'wallet/gpb/tariff.html.twig';
  74.         $modified $this->tracker->get($template);
  75.         $response $this->render($template, ['modified' => $modified]);
  76.         $response->headers->set('Last-Modified'$modified);
  77.         return $response;
  78.     }
  79. }