12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Predis\Command;
- abstract class ScriptedCommand extends ServerEvalSHA
- {
-
- abstract public function getScript();
-
- protected function getKeysCount()
- {
- return 0;
- }
-
- public function getKeys()
- {
- return array_slice($this->getArguments(), 2, $this->getKeysCount());
- }
-
- protected function filterArguments(Array $arguments)
- {
- if (($numkeys = $this->getKeysCount()) && $numkeys < 0) {
- $numkeys = count($arguments) + $numkeys;
- }
- return array_merge(array(sha1($this->getScript()), (int) $numkeys), $arguments);
- }
-
- public function getEvalArguments()
- {
- $arguments = $this->getArguments();
- $arguments[0] = $this->getScript();
- return $arguments;
- }
- }
|