Predis\Connection\StreamConnection::write PHP Method

write() protected method

Performs a write operation over the stream of the buffer containing a command serialized with the Redis wire protocol.
protected write ( string $buffer )
$buffer string Representation of a command in the Redis wire protocol.
    protected function write($buffer)
    {
        $socket = $this->getResource();
        while (($length = strlen($buffer)) > 0) {
            $written = @fwrite($socket, $buffer);
            if ($length === $written) {
                return;
            }
            if ($written === false || $written === 0) {
                $this->onConnectionError('Error while writing bytes to the server.');
            }
            $buffer = substr($buffer, $written);
        }
    }