src/Controller/XCartController.php line 17

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace XCart\Controller;
  7. use Symfony\Component\HttpFoundation\Response;
  8. class XCartController
  9. {
  10.     /**
  11.      * Is customer action
  12.      */
  13.     public function index(): Response
  14.     {
  15.         return $this->run();
  16.     }
  17.     public function admin(): Response
  18.     {
  19.         return $this->run();
  20.     }
  21.     private function run(): Response
  22.     {
  23.         $xc \XLite::getInstance();
  24.         $xc->processRequest();
  25.         $response = new Response($xc->getContent(), $xc->getStatusCode(), $xc->getHeaders());
  26.         foreach ($xc->getCookiesForHeaders() as $cookie) {
  27.             $response->headers->setCookie($cookie);
  28.         }
  29.         return $response;
  30.     }
  31. }