/** * Sends when the Service is done working, this sends the result to the Worker Handler. */ public function handleResult() { // No result $result = $this->worker->getResult(); if ($result === null) { return; } // Invalid worker state, wait for a response first. if (!$this->isWorkerHandlerReady()) { return; } $this->sendToWorkerHandler(new Protocol\JobResult($this->worker->getRequestId(), $result)); $this->worker->setState(Worker::RESULT); }