Predis\Client::executeRaw PHP Méthode

executeRaw() public méthode

It is possible to identify Redis error responses from normal responses using the second optional argument which is populated by reference.
public executeRaw ( array $arguments, boolean &$error = null ) : mixed
$arguments array Command arguments as defined by the command signature.
$error boolean Set to TRUE when Redis returned an error response.
Résultat mixed
    public function executeRaw(array $arguments, &$error = null)
    {
        $error = false;
        $commandID = array_shift($arguments);
        $response = $this->connection->executeCommand(new RawCommand($commandID, $arguments));
        if ($response instanceof ResponseInterface) {
            if ($response instanceof ErrorResponseInterface) {
                $error = true;
            }
            return (string) $response;
        }
        return $response;
    }

Usage Example

Exemple #1
0
 /**
  * @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()));
 }
All Usage Examples Of Predis\Client::executeRaw