Browse Source

Rename IServerProfile::registerCommand() to IServerProfile::defineCommand().

Daniele Alessandri 14 years ago
parent
commit
f8844ef8b8

+ 1 - 1
README.markdown

@@ -103,7 +103,7 @@ client instance at runtime. Actually, it is easier done than said:
     }
 
     $redis = new Predis\Client();
-    $redis->getProfile()->registerCommand('BrandNewRedisCommand', 'newcmd');
+    $redis->getProfile()->defineCommand('BrandNewRedisCommand', 'newcmd');
     $redis->newcmd();
 
 

+ 2 - 2
lib/Predis/Profiles/IServerProfile.php

@@ -6,7 +6,7 @@ interface IServerProfile {
     public function getVersion();
     public function supportsCommand($command);
     public function supportsCommands(Array $commands);
-    public function registerCommand($command, $aliases);
-    public function registerCommands(Array $commands);
+    public function defineCommand($command, $aliases);
+    public function defineCommands(Array $commands);
     public function createCommand($method, $arguments = array());
 }

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

@@ -88,13 +88,13 @@ abstract class ServerProfile implements IServerProfile {
         return $command;
     }
 
-    public function registerCommands(Array $commands) {
+    public function defineCommands(Array $commands) {
         foreach ($commands as $command => $aliases) {
-            $this->registerCommand($command, $aliases);
+            $this->defineCommand($command, $aliases);
         }
     }
 
-    public function registerCommand($command, $aliases) {
+    public function defineCommand($command, $aliases) {
         $commandReflection = new \ReflectionClass($command);
 
         if (!$commandReflection->isSubclassOf('\Predis\Commands\ICommand')) {

+ 1 - 1
test/PredisFeaturesTest.php

@@ -153,7 +153,7 @@ class PredisClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
         $cmdClass = '\Predis\Commands\Multi';
 
         $this->assertFalse($profile->supportsCommand($cmdId));
-        $profile->registerCommand(new $cmdClass(), $cmdId);
+        $profile->defineCommand(new $cmdClass(), $cmdId);
         $this->assertTrue($profile->supportsCommand($cmdId));
         $this->assertType($cmdClass, $profile->createCommand($cmdId));
     }