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

This commit is contained in:
Daniele Alessandri
2011-03-05 10:51:54 +01:00
parent 3681c1e622
commit f8844ef8b8
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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));
}