mirror of
https://github.com/predis/predis.git
synced 2026-09-14 04:17:14 +00:00
Reuse code.
This commit is contained in:
@@ -2,16 +2,15 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
use Predis\Helpers;
|
||||
|
||||
class HashDeleteV24x extends Command {
|
||||
public function getId() {
|
||||
return 'HDEL';
|
||||
}
|
||||
|
||||
public function filterArguments(Array $arguments) {
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
return $arguments;
|
||||
return Helpers::filterVariadicValues($arguments);
|
||||
}
|
||||
|
||||
public function parseResponse($data) {
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
use Predis\Helpers;
|
||||
|
||||
class ListPushTailV24x extends Command {
|
||||
public function getId() {
|
||||
return 'RPUSH';
|
||||
}
|
||||
|
||||
public function filterArguments(Array $arguments) {
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
return $arguments;
|
||||
return Helpers::filterVariadicValues($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
use Predis\Helpers;
|
||||
|
||||
class SetAddV24x extends Command {
|
||||
public function getId() {
|
||||
return 'SADD';
|
||||
}
|
||||
|
||||
public function filterArguments(Array $arguments) {
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
return $arguments;
|
||||
return Helpers::filterVariadicValues($arguments);
|
||||
}
|
||||
|
||||
public function parseResponse($data) {
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
use Predis\Helpers;
|
||||
|
||||
class SetRemoveV24x extends Command {
|
||||
public function getId() {
|
||||
return 'SREM';
|
||||
}
|
||||
|
||||
public function filterArguments(Array $arguments) {
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
return $arguments;
|
||||
return Helpers::filterVariadicValues($arguments);
|
||||
}
|
||||
|
||||
public function parseResponse($data) {
|
||||
|
||||
@@ -26,4 +26,11 @@ class Helpers {
|
||||
}
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
public static function filterVariadicValues(Array $arguments) {
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user