Predis\Connection\CompositeConnectionInterface::readBuffer PHP Method

readBuffer() public method

 @param int $length Number of bytes to read from the connection.
public readBuffer ( integer $length ) : string
$length integer
return string
    public function readBuffer($length);

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 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."));
     }
     if ($length >= 0) {
         return substr($connection->readBuffer($length + 2), 0, -2);
     }
     if ($length == -1) {
         return null;
     }
     CommunicationException::handle(new ProtocolException($connection, "Value '{$payload}' is not a valid length for a bulk response."));
     return;
 }
All Usage Examples Of Predis\Connection\CompositeConnectionInterface::readBuffer