<?php
namespace Modules\Orders\ImportedOrders\Webservice\Model\ExecOperation; abstract class GeneralAbstract { protected $request; protected $response; public function __construct(array $R, \stdClass $request, \Modules\Orders\ImportedOrders\Webservice\Model\Response $response) { $this->request = $request; $this->response = $response; } public function executeOperation() { $this->checkAuth(); $this->checkRequest(); $this->executeRequestedOperation(); } protected function checkAuth() { try { $sessionTokenObject = new \Modules\Orders\ImportedOrders\Webservice\Model\SessionToken($this->request->username); $sessionTokenObject->check($this->request->sessionToken); } catch (\Modules\Orders\ImportedOrders\Webservice\Model\SessionTokenException $ex) { \Engine\Os::sleep(\Engine\RandomGenerator::randomFloat(1, 2)); throw new \RuntimeException($ex->getMessage()); } } abstract protected function checkRequest(); abstract protected function executeRequestedOperation(); }