mirror of
https://github.com/predis/predis.git
synced 2026-09-05 07:16:44 +00:00
Rename IServerProfile::registerCommand() to IServerProfile::defineCommand().
This commit is contained in:
+1
-1
@@ -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();
|
||||
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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')) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user