15 private $errorCollection;
21 private function __construct()
26 private static function createHandler() :
self
33 return new EventResult($this->getEventStatus(), [
'ERROR_COLLECTION' => $this->errors()]);
36 private function getEventStatus() :
int
38 return $this->hasErrors() ? EventResult::ERROR : EventResult::SUCCESS;
43 return $this->errorCollection;
46 private function hasErrors() :
bool
48 return $this->errorCollection->count() > 0;
51 private function setClientId($clientId) :
self
53 if(!$this->hasErrors())
55 if (!isset($clientId))
57 $this->errorCollection->setError(
new Main\
Error(
"client is null"));
59 $this->clientId = $clientId;
65 private function setEngineCode($code) :
self
67 if(!$this->hasErrors())
71 $this->errorCollection->setError(
new Main\
Error(
'Engine code is not string'));
77 private function run() :
self
79 if(!$this->hasErrors())
81 $row = Internals\ServiceQueueTable::getRow([
84 'CLIENT_ID' => $this->clientId,
85 '=SERVICE_TYPE' => $this->code,
90 $result = Internals\ServiceQueueTable::delete($row[
'ID']);
91 if(!$result->isSuccess())
93 $this->errors()->add($result->getErrors());
110 static::createHandler()
111 ->setClientId($clientId)
112 ->setEngineCode($engineCode)