Predis\Connection\StreamConnection::writeRequest PHP Method

writeRequest() public method

public writeRequest ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface
    public function writeRequest(CommandInterface $command)
    {
        $commandID = $command->getId();
        $arguments = $command->getArguments();
        $cmdlen = strlen($commandID);
        $reqlen = count($arguments) + 1;
        $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandID}\r\n";
        foreach ($arguments as $argument) {
            $arglen = strlen($argument);
            $buffer .= "\${$arglen}\r\n{$argument}\r\n";
        }
        $this->write($buffer);
    }

Usage Example

 public function writeRequest(CommandInterface $command)
 {
     parent::writeRequest($command);
     $this->storeDebug($command, '->');
 }