public function handle(CompositeConnectionInterface $connection, $payload)
{
$length = (int) $payload;
if ("{$length}" !== $payload) {
CommunicationException::handle(new ProtocolException($connection, "Cannot parse '{$payload}' as a valid length for a bulk response [{$connection->getParameters()}]"));
}
if ($length >= 0) {
return substr($connection->readBuffer($length + 2), 0, -2);
}
if ($length == -1) {
return;
}
CommunicationException::handle(new ProtocolException($connection, "Value '{$payload}' is not a valid length for a bulk response [{$connection->getParameters()}]"));
return;
}