generated from Nodarx/template
fix: message streaming
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ final class UntaggedResponse implements ResponseInterface
|
||||
private readonly string $label,
|
||||
private readonly string $payload,
|
||||
private readonly string $raw,
|
||||
private readonly ?int $payloadOffset = null,
|
||||
) {}
|
||||
|
||||
public function label(): string
|
||||
@@ -19,6 +20,12 @@ final class UntaggedResponse implements ResponseInterface
|
||||
|
||||
public function payload(): string
|
||||
{
|
||||
// ProtocolReader records an offset for potentially large responses and
|
||||
// only materializes the payload for command parsers that actually need it.
|
||||
if ($this->payloadOffset !== null) {
|
||||
return substr($this->raw, $this->payloadOffset);
|
||||
}
|
||||
|
||||
return $this->payload;
|
||||
}
|
||||
|
||||
@@ -27,7 +34,7 @@ final class UntaggedResponse implements ResponseInterface
|
||||
*/
|
||||
public function payloadTokens(): array
|
||||
{
|
||||
$payload = trim($this->payload);
|
||||
$payload = trim($this->payload());
|
||||
|
||||
if ($payload === '') {
|
||||
return [];
|
||||
@@ -40,4 +47,4 @@ final class UntaggedResponse implements ResponseInterface
|
||||
{
|
||||
return $this->raw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user