/** * @inheritdoc */ public function execute(CommandInterface $command) { if (!$this->isConnected()) { throw new ConnectionException('No connection established'); } return $this->client->executeRaw(array_merge([$command->getCommand()], $command->getArguments())); }
/** * @inheritdoc */ public function execute(CommandInterface $command) { $commandName = $command->getCommand(); $arguments = $command->getArguments(); $totalArguments = count($arguments); $parts = ['*' . ($totalArguments + 1), '$' . strlen($commandName), $commandName]; for ($i = 0; $i < $totalArguments; $i++) { $argument = $arguments[$i]; $parts[] = '$' . strlen($argument); $parts[] = $argument; } $this->send(implode("\r\n", $parts) . "\r\n"); return $this->receive($command->isBlocking()); }