* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ require_once dirname(__FILE__) . '/../../bootstrap.php'; class RetailcrmAdminPostAbstractController extends RetailcrmAdminAbstractController { public function postProcess() { $this->ajaxDie(json_encode($this->getData())); } protected function getData() { try { switch ($_SERVER['REQUEST_METHOD']) { case 'POST': return $this->postHandler(); case 'GET': return $this->getHandler(); default: return []; } } catch (Exception $e) { return RetailcrmJsonResponse::invalidResponse($e->getMessage()); } catch (Error $e) { return RetailcrmJsonResponse::invalidResponse($e->getMessage()); } } /** * @return array * * @throws Exception|Error */ protected function postHandler() { throw new Exception('Method not allowed'); } /** * @return array * * @throws Exception|Error */ protected function getHandler() { throw new Exception('Method not allowed'); } }