From c2a61a31131ee150c074cf361af0dd3e4040793e Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Mon, 4 Apr 2011 11:31:26 +0200 Subject: [PATCH] Rename Predis\CommandPipeline to Predis\PipelineContext. --- ...ommandPipeline.php => PipelineContext.php} | 0 lib/Predis/Client.php | 8 +++---- ...ommandPipeline.php => PipelineContext.php} | 2 +- test/ClientFeaturesTest.php | 24 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) rename examples/{CommandPipeline.php => PipelineContext.php} (100%) rename lib/Predis/{CommandPipeline.php => PipelineContext.php} (98%) diff --git a/examples/CommandPipeline.php b/examples/PipelineContext.php similarity index 100% rename from examples/CommandPipeline.php rename to examples/PipelineContext.php diff --git a/lib/Predis/Client.php b/lib/Predis/Client.php index 0dddf7d7..54a939fa 100644 --- a/lib/Predis/Client.php +++ b/lib/Predis/Client.php @@ -181,22 +181,22 @@ class Client { if (isset($options)) { if (isset($options['safe']) && $options['safe'] == true) { $connection = $this->_connection; - $pipeline = new CommandPipeline($this, + $pipeline = new PipelineContext($this, Utils::isCluster($connection) ? new Pipeline\SafeClusterExecutor($connection) : new Pipeline\SafeExecutor($connection) ); } else { - $pipeline = new CommandPipeline($this); + $pipeline = new PipelineContext($this); } } return $this->pipelineExecute( - $pipeline ?: new CommandPipeline($this), $pipelineBlock + $pipeline ?: new PipelineContext($this), $pipelineBlock ); } - private function pipelineExecute(CommandPipeline $pipeline, $block) { + private function pipelineExecute(PipelineContext $pipeline, $block) { return $block !== null ? $pipeline->execute($block) : $pipeline; } diff --git a/lib/Predis/CommandPipeline.php b/lib/Predis/PipelineContext.php similarity index 98% rename from lib/Predis/CommandPipeline.php rename to lib/Predis/PipelineContext.php index 8788b39a..28f240b3 100644 --- a/lib/Predis/CommandPipeline.php +++ b/lib/Predis/PipelineContext.php @@ -5,7 +5,7 @@ namespace Predis; use Predis\Commands\ICommand; use Predis\Pipeline\IPipelineExecutor; -class CommandPipeline { +class PipelineContext { private $_client, $_pipelineBuffer, $_returnValues, $_running, $_executor; public function __construct(Client $client, IPipelineExecutor $executor = null) { diff --git a/test/ClientFeaturesTest.php b/test/ClientFeaturesTest.php index 0af35188..9413b6e6 100644 --- a/test/ClientFeaturesTest.php +++ b/test/ClientFeaturesTest.php @@ -387,21 +387,21 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { } - /* Client + CommandPipeline */ + /* Client + PipelineContext */ - function testCommandPipeline_Simple() { + function testPipelineContext_Simple() { $client = RC::getConnection(); $client->flushdb(); $pipe = $client->pipeline(); - $this->assertInstanceOf('\Predis\CommandPipeline', $pipe); - $this->assertInstanceOf('\Predis\CommandPipeline', $pipe->set('foo', 'bar')); - $this->assertInstanceOf('\Predis\CommandPipeline', $pipe->set('hoge', 'piyo')); - $this->assertInstanceOf('\Predis\CommandPipeline', $pipe->mset(array( + $this->assertInstanceOf('\Predis\PipelineContext', $pipe); + $this->assertInstanceOf('\Predis\PipelineContext', $pipe->set('foo', 'bar')); + $this->assertInstanceOf('\Predis\PipelineContext', $pipe->set('hoge', 'piyo')); + $this->assertInstanceOf('\Predis\PipelineContext', $pipe->mset(array( 'foofoo' => 'barbar', 'hogehoge' => 'piyopiyo' ))); - $this->assertInstanceOf('\Predis\CommandPipeline', $pipe->mget(array( + $this->assertInstanceOf('\Predis\PipelineContext', $pipe->mget(array( 'foo', 'hoge', 'foofoo', 'hogehoge' ))); @@ -412,7 +412,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals('barbar', $replies[3][2]); } - function testCommandPipeline_FluentInterface() { + function testPipelineContext_FluentInterface() { $client = RC::getConnection(); $client->flushdb(); @@ -421,7 +421,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals('bar', $replies[2]); } - function testCommandPipeline_CallableAnonymousBlock() { + function testPipelineContext_CallableAnonymousBlock() { $client = RC::getConnection(); $client->flushdb(); @@ -435,7 +435,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals('bar', $replies[2]); } - function testCommandPipeline_ClientExceptionInCallableBlock() { + function testPipelineContext_ClientExceptionInCallableBlock() { $client = RC::getConnection(); $client->flushdb(); @@ -449,7 +449,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $this->assertFalse($client->exists('foo')); } - function testCommandPipeline_ServerExceptionInCallableBlock() { + function testPipelineContext_ServerExceptionInCallableBlock() { $client = RC::createConnection(array('throw_errors' => false)); $client->flushdb(); @@ -465,7 +465,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase { $this->assertTrue($client->exists('hoge')); } - function testCommandPipeline_Flush() { + function testPipelineContext_Flush() { $client = RC::getConnection(); $client->flushdb();