mirror of
https://github.com/predis/predis.git
synced 2026-09-04 23:08:00 +00:00
Drop useless method from base command class.
This commit is contained in:
+1
-13
@@ -21,24 +21,12 @@ abstract class Command implements CommandInterface
|
||||
private $slot;
|
||||
private $arguments = array();
|
||||
|
||||
/**
|
||||
* Returns a filtered array of the arguments.
|
||||
*
|
||||
* @param array $arguments List of arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
{
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
$this->arguments = $this->filterArguments($arguments);
|
||||
$this->arguments = $arguments;
|
||||
unset($this->slot);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class GeospatialGeoAdd extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
foreach (array_pop($arguments) as $item) {
|
||||
@@ -39,6 +39,6 @@ class GeospatialGeoAdd extends Command
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ class GeospatialGeoHash extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
$members = array_pop($arguments);
|
||||
$arguments = array_merge($arguments, $members);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ class GeospatialGeoPos extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
$members = array_pop($arguments);
|
||||
$arguments = array_merge($arguments, $members);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class GeospatialGeoRadius extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if ($arguments && is_array(end($arguments))) {
|
||||
$options = array_change_key_case(array_pop($arguments), CASE_UPPER);
|
||||
@@ -68,6 +68,6 @@ class GeospatialGeoRadius extends Command
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class HashDelete extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class HashGetMultiple extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ class HashScan extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 3 && is_array($arguments[2])) {
|
||||
$options = $this->prepareOptions(array_pop($arguments));
|
||||
$arguments = array_merge($arguments, $options);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ class HashSetMultiple extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
$flattenedKVs = array($arguments[0]);
|
||||
@@ -42,9 +42,9 @@ class HashSetMultiple extends Command
|
||||
$flattenedKVs[] = $v;
|
||||
}
|
||||
|
||||
return $flattenedKVs;
|
||||
$arguments = $flattenedKVs;
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class HyperLogLogAdd extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class HyperLogLogCount extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class HyperLogLogMerge extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class KeyDelete extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class KeyMigrate extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (is_array(end($arguments))) {
|
||||
foreach (array_pop($arguments) as $modifier => $value) {
|
||||
@@ -47,6 +47,6 @@ class KeyMigrate extends Command
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ class KeyScan extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
$options = $this->prepareOptions(array_pop($arguments));
|
||||
$arguments = array_merge($arguments, $options);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,10 +31,12 @@ class KeySort extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 1) {
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$query = array($arguments[0]);
|
||||
@@ -80,6 +82,6 @@ class KeySort extends Command
|
||||
$query[] = $sortParams['STORE'];
|
||||
}
|
||||
|
||||
return $query;
|
||||
parent::setArguments($query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ class ListPopFirstBlocking extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[0])) {
|
||||
list($arguments, $timeout) = $arguments;
|
||||
array_push($arguments, $timeout);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class ListPushTail extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class PubSubSubscribe extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class PubSubUnsubscribe extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ class ServerSlaveOf extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 0 || $arguments[0] === 'NO ONE') {
|
||||
return array('NO', 'ONE');
|
||||
$arguments = array('NO', 'ONE');
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class SetAdd extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class SetIntersection extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ class SetIntersectionStore extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 2 && is_array($arguments[1])) {
|
||||
return array_merge(array($arguments[0]), $arguments[1]);
|
||||
$arguments = array_merge(array($arguments[0]), $arguments[1]);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class SetRemove extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ class SetScan extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 3 && is_array($arguments[2])) {
|
||||
$options = $this->prepareOptions(array_pop($arguments));
|
||||
$arguments = array_merge($arguments, $options);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ class StringBitOp extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 3 && is_array($arguments[2])) {
|
||||
list($operation, $destination) = $arguments;
|
||||
@@ -39,6 +39,6 @@ class StringBitOp extends Command
|
||||
array_unshift($arguments, $operation, $destination);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@ class StringGetMultiple extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeArguments($arguments);
|
||||
$arguments = self::normalizeArguments($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class StringSetMultiple extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 1 && is_array($arguments[0])) {
|
||||
$flattenedKVs = array();
|
||||
@@ -42,9 +42,9 @@ class StringSetMultiple extends Command
|
||||
$flattenedKVs[] = $v;
|
||||
}
|
||||
|
||||
return $flattenedKVs;
|
||||
$arguments = $flattenedKVs;
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ class TransactionWatch extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (isset($arguments[0]) && is_array($arguments[0])) {
|
||||
return $arguments[0];
|
||||
$arguments = $arguments[0];
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ZSetAdd extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (is_array(end($arguments))) {
|
||||
foreach (array_pop($arguments) as $member => $score) {
|
||||
@@ -40,6 +40,6 @@ class ZSetAdd extends Command
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ZSetRange extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 4) {
|
||||
$lastType = gettype($arguments[3]);
|
||||
@@ -44,12 +44,11 @@ class ZSetRange extends Command
|
||||
|
||||
if ($lastType === 'array') {
|
||||
$options = $this->prepareOptions(array_pop($arguments));
|
||||
|
||||
return array_merge($arguments, $options);
|
||||
$arguments = array_merge($arguments, $options);
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,8 +31,10 @@ class ZSetRemove extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
return self::normalizeVariadic($arguments);
|
||||
$arguments = self::normalizeVariadic($arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ class ZSetScan extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (count($arguments) === 3 && is_array($arguments[2])) {
|
||||
$options = $this->prepareOptions(array_pop($arguments));
|
||||
$arguments = array_merge($arguments, $options);
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ class ZSetUnionStore extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
$options = array();
|
||||
$argc = count($arguments);
|
||||
@@ -47,7 +47,7 @@ class ZSetUnionStore extends Command
|
||||
);
|
||||
}
|
||||
|
||||
return array_merge($arguments, $options);
|
||||
parent::setArguments(array_merge($arguments, $options));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,13 +57,15 @@ abstract class ScriptCommand extends ServerEvalSHA
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterArguments(array $arguments)
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
if (($numkeys = $this->getKeysCount()) && $numkeys < 0) {
|
||||
$numkeys = count($arguments) + $numkeys;
|
||||
}
|
||||
|
||||
return array_merge(array(sha1($this->getScript()), (int) $numkeys), $arguments);
|
||||
$arguments = array_merge(array(sha1($this->getScript()), (int) $numkeys), $arguments);
|
||||
|
||||
parent::setArguments($arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user