From a386263d84982e0e3ef135e62b3a7e89dc0ad4e5 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 3 May 2011 17:37:39 +0200 Subject: [PATCH] Add an helper method to get the actual keys from the whole argument list. --- lib/Predis/Commands/ScriptedCommand.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Predis/Commands/ScriptedCommand.php b/lib/Predis/Commands/ScriptedCommand.php index bb366e18..69c9ca0c 100644 --- a/lib/Predis/Commands/ScriptedCommand.php +++ b/lib/Predis/Commands/ScriptedCommand.php @@ -13,4 +13,12 @@ abstract class ScriptedCommand extends ServerEval { } return array_merge(array($this->getScript(), $keys), $arguments); } + + protected function getKeys() { + $arguments = $this->getArguments(); + if (($keys = $this->keysCount()) === -1) { + return array_slice($arguments, 2); + } + return array_slice($arguments, 2, $keys); + } }