ScriptedCommand.php 656 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Predis\Commands;
  3. abstract class ScriptedCommand extends ServerEval
  4. {
  5. public abstract function getScript();
  6. protected function keysCount()
  7. {
  8. // The default behaviour for the base class is to use all the arguments
  9. // passed to a scripted command to populate the KEYS table in Lua.
  10. return count($this->getArguments());
  11. }
  12. protected function filterArguments(Array $arguments)
  13. {
  14. return array_merge(array($this->getScript(), $this->keysCount()), $arguments);
  15. }
  16. protected function getKeys()
  17. {
  18. return array_slice($this->getArguments(), 2, $this->keysCount());
  19. }
  20. }