/** * Starts execution of callback. * * @return Executor */ public function start() { $this->_memory->set(Utils::getStatusKey($this->_id), Enum\Status::START); try { $callback = unserialize($this->_memory->get(Utils::getCallbackKey($this->_id))); /* @var $callback Callback */ $this->_memory->set(Utils::getStatusKey($this->_id), Enum\Status::RUN); $result = $callback->invoke(); $this->_memory->set(Utils::getResultKey($this->_id), $result); $this->_memory->set(Utils::getStatusKey($this->_id), Enum\Status::DONE); } catch (\Exception $exp) { $this->_memory->set(Utils::getResultKey($this->_id), $exp->getMessage() . "\n" . $exp->getTraceAsString()); $this->_memory->set(Utils::getStatusKey($this->_id), Enum\Status::ERROR); } return $this; }
/** * It cleans metadata after execution. * * @return Client */ public function clean() { $this->_meomry->delete(Utils::getStatusKey($this->_id)); $this->_meomry->delete(Utils::getResultKey($this->_id)); $this->_meomry->delete(Utils::getCallbackKey($this->_id)); return $this; }