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);
    }