Browse Source

Remove Predis\Commands\Command::setArguments().

Daniele Alessandri 14 năm trước cách đây
mục cha
commit
944a478272

+ 1 - 6
lib/Predis/Commands/Command.php

@@ -12,12 +12,7 @@ abstract class Command implements ICommand {
         return $arguments;
     }
 
-    public function setArguments(/* arguments */) {
-        $this->_arguments = $this->filterArguments(func_get_args());
-        unset($this->_hash);
-    }
-
-    public function setArgumentsArray(Array $arguments) {
+    public function setArguments(Array $arguments) {
         $this->_arguments = $this->filterArguments($arguments);
         unset($this->_hash);
     }

+ 1 - 1
lib/Predis/Commands/ICommand.php

@@ -7,7 +7,7 @@ use Predis\Distribution\IDistributionStrategy;
 interface ICommand {
     public function getId();
     public function getHash(IDistributionStrategy $distributor);
-    public function setArgumentsArray(Array $arguments);
+    public function setArguments(Array $arguments);
     public function getArguments();
     public function parseResponse($data);
 }

+ 1 - 1
lib/Predis/Profiles/ServerProfile.php

@@ -81,7 +81,7 @@ abstract class ServerProfile implements IServerProfile, IPreprocessingSupport {
         }
         $commandClass = $this->_registeredCommands[$method];
         $command = new $commandClass();
-        $command->setArgumentsArray($arguments);
+        $command->setArguments($arguments);
         return $command;
     }
 

+ 1 - 7
test/ClientFeaturesTest.php

@@ -65,13 +65,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
         $cmdArgs = array('key1', 'key2', 'key3');
 
         $cmd = new \Predis\Commands\GetMultiple();
-        $cmd->setArgumentsArray($cmdArgs);
-        $this->assertEquals($cmdArgs[0], $cmd->getArgument(0));
-        $this->assertEquals($cmdArgs[1], $cmd->getArgument(1));
-        $this->assertEquals($cmdArgs[2], $cmd->getArgument(2));
-
-        $cmd = new \Predis\Commands\GetMultiple();
-        $cmd->setArguments('key1', 'key2', 'key3');
+        $cmd->setArguments($cmdArgs);
         $this->assertEquals($cmdArgs[0], $cmd->getArgument(0));
         $this->assertEquals($cmdArgs[1], $cmd->getArgument(1));
         $this->assertEquals($cmdArgs[2], $cmd->getArgument(2));