/** * @param string $exception * @param ProtocolInterface $protocol * @return bool */ public function __invoke($exception, ProtocolInterface $protocol) { return StringSupport::match($this->exception, $protocol->getException()); }
/** * @param ProtocolInterface $protocol * @return bool */ protected function handleReceiveResponse(ProtocolInterface $protocol) { $pid = $protocol->getPid(); if (!$this->existsRequest($pid)) { return false; } $message = $protocol->getMessage(); $exception = $protocol->getException(); if ($exception === '') { $this->resolveRequest($pid, $message); } else { if ($exception === TaskIncompleteException::class) { $this->cancelRequest($pid, new ThrowableProxy([$exception, $message])); } else { $this->rejectRequest($pid, new ThrowableProxy([$exception, $message])); } } return true; }