From ee45de4f0e1aeb670fcc89f9bd8a39229b9b22f4 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 7 Dec 2013 15:22:42 +0100 Subject: [PATCH] Rename base response interface to Predis\Response\ResponseInterface. --- CHANGELOG.md | 3 ++- lib/Predis/Client.php | 6 +++--- lib/Predis/Pipeline/Atomic.php | 2 +- lib/Predis/Pipeline/Pipeline.php | 2 +- lib/Predis/Response/ErrorInterface.php | 2 +- lib/Predis/Response/Iterator/MultiBulkIterator.php | 2 +- .../Response/{ObjectInterface.php => ResponseInterface.php} | 4 ++-- lib/Predis/Response/Status.php | 2 +- tests/Predis/Pipeline/PipelineTest.php | 2 +- tests/Predis/Response/ErrorTest.php | 2 +- tests/Predis/Response/ServerExceptionTest.php | 2 +- tests/Predis/Response/StatusTest.php | 2 +- 12 files changed, 16 insertions(+), 15 deletions(-) rename lib/Predis/Response/{ObjectInterface.php => ResponseInterface.php} (80%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f7fcc68..b692498f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,8 @@ v0.9.0 (201x-xx-xx) - All of the interfaces and classes related to translated Redis response types have been moved in the new `Predis\Response` namespace and most of them have - been renamed to make their fully-qualified name shorter and less redundant. + been renamed to make their fully-qualified name less redundant. Now the base + response interface is `Predis\Response\ResponseInterface`. - The profile factory code has been extrapolated from the abstract Redis profile class and it's now in `Predis\Profile\Factory`. diff --git a/lib/Predis/Client.php b/lib/Predis/Client.php index 2fab2e6a..7b0ddc2b 100644 --- a/lib/Predis/Client.php +++ b/lib/Predis/Client.php @@ -268,7 +268,7 @@ class Client implements ClientInterface $command = new RawCommand($arguments); $response = $this->connection->executeCommand($command); - if ($response instanceof Response\ObjectInterface) { + if ($response instanceof Response\ResponseInterface) { if ($response instanceof Response\ErrorInterface) { $error = true; } @@ -310,7 +310,7 @@ class Client implements ClientInterface { $response = $this->connection->executeCommand($command); - if ($response instanceof Response\ObjectInterface) { + if ($response instanceof Response\ResponseInterface) { if ($response instanceof Response\ErrorInterface) { $response = $this->onResponseError($command, $response); } @@ -336,7 +336,7 @@ class Client implements ClientInterface $response = $this->executeCommand($eval); - if (!$response instanceof Response\ObjectInterface) { + if (!$response instanceof Response\ResponseInterface) { $response = $command->parseResponse($response); } diff --git a/lib/Predis/Pipeline/Atomic.php b/lib/Predis/Pipeline/Atomic.php index b28169aa..5b56c1b4 100644 --- a/lib/Predis/Pipeline/Atomic.php +++ b/lib/Predis/Pipeline/Atomic.php @@ -102,7 +102,7 @@ class Atomic extends Pipeline $command = $commands->dequeue(); $response = $executed[$i]; - if (!$response instanceof Response\ObjectInterface) { + if (!$response instanceof Response\ResponseInterface) { $responses[] = $command->parseResponse($response); } else if ($response instanceof Response\ErrorInterface && $exceptions) { $this->exception($connection, $response); diff --git a/lib/Predis/Pipeline/Pipeline.php b/lib/Predis/Pipeline/Pipeline.php index 51add7d7..e9f50696 100644 --- a/lib/Predis/Pipeline/Pipeline.php +++ b/lib/Predis/Pipeline/Pipeline.php @@ -132,7 +132,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface $command = $commands->dequeue(); $response = $connection->readResponse($command); - if (!$response instanceof Response\ObjectInterface) { + if (!$response instanceof Response\ResponseInterface) { $responses[] = $command->parseResponse($response); } else if ($response instanceof Response\ErrorInterface && $exceptions) { $this->exception($connection, $response); diff --git a/lib/Predis/Response/ErrorInterface.php b/lib/Predis/Response/ErrorInterface.php index a5ecf4c8..6a1c5060 100644 --- a/lib/Predis/Response/ErrorInterface.php +++ b/lib/Predis/Response/ErrorInterface.php @@ -17,7 +17,7 @@ namespace Predis\Response; * * @author Daniele Alessandri */ -interface ErrorInterface extends ObjectInterface +interface ErrorInterface extends ResponseInterface { /** * Returns the error message diff --git a/lib/Predis/Response/Iterator/MultiBulkIterator.php b/lib/Predis/Response/Iterator/MultiBulkIterator.php index bafc3c4a..dbd24db0 100644 --- a/lib/Predis/Response/Iterator/MultiBulkIterator.php +++ b/lib/Predis/Response/Iterator/MultiBulkIterator.php @@ -27,7 +27,7 @@ use Predis\Response; * * @author Daniele Alessandri */ -abstract class MultiBulkIterator implements Iterator, Countable, Response\ObjectInterface +abstract class MultiBulkIterator implements Iterator, Countable, Response\ResponseInterface { protected $current; protected $position; diff --git a/lib/Predis/Response/ObjectInterface.php b/lib/Predis/Response/ResponseInterface.php similarity index 80% rename from lib/Predis/Response/ObjectInterface.php rename to lib/Predis/Response/ResponseInterface.php index 8a01107e..0af13574 100644 --- a/lib/Predis/Response/ObjectInterface.php +++ b/lib/Predis/Response/ResponseInterface.php @@ -12,10 +12,10 @@ namespace Predis\Response; /** - * Represents a complex reply object from Redis. + * Represents a complex response object from Redis. * * @author Daniele Alessandri */ -interface ObjectInterface +interface ResponseInterface { } diff --git a/lib/Predis/Response/Status.php b/lib/Predis/Response/Status.php index 00ba2d7f..487b9fd4 100644 --- a/lib/Predis/Response/Status.php +++ b/lib/Predis/Response/Status.php @@ -16,7 +16,7 @@ namespace Predis\Response; * * @author Daniele Alessandri */ -class Status implements ObjectInterface +class Status implements ResponseInterface { private static $OK; private static $QUEUED; diff --git a/tests/Predis/Pipeline/PipelineTest.php b/tests/Predis/Pipeline/PipelineTest.php index 2a105e90..8d6aa887 100644 --- a/tests/Predis/Pipeline/PipelineTest.php +++ b/tests/Predis/Pipeline/PipelineTest.php @@ -71,7 +71,7 @@ class PipelineTest extends PredisTestCase */ public function testDoesNotParseComplexResponseObjects() { - $object = $this->getMock('Predis\Response\ObjectInterface'); + $object = $this->getMock('Predis\Response\ResponseInterface'); $connection = $this->getMock('Predis\Connection\SingleConnectionInterface'); $connection->expects($this->once()) diff --git a/tests/Predis/Response/ErrorTest.php b/tests/Predis/Response/ErrorTest.php index 508a08f5..37022c18 100644 --- a/tests/Predis/Response/ErrorTest.php +++ b/tests/Predis/Response/ErrorTest.php @@ -28,7 +28,7 @@ class ErrorTest extends PredisTestCase $error = new Error(self::ERR_WRONG_KEY_TYPE); $this->assertInstanceOf('Predis\Response\ErrorInterface', $error); - $this->assertInstanceOf('Predis\Response\ObjectInterface', $error); + $this->assertInstanceOf('Predis\Response\ResponseInterface', $error); } /** diff --git a/tests/Predis/Response/ServerExceptionTest.php b/tests/Predis/Response/ServerExceptionTest.php index 3b030399..b74e66bf 100644 --- a/tests/Predis/Response/ServerExceptionTest.php +++ b/tests/Predis/Response/ServerExceptionTest.php @@ -39,7 +39,7 @@ class ServerExceptionTest extends PredisTestCase $this->assertInstanceOf('Predis\Response\ServerException', $exception); $this->assertInstanceOf('Predis\Response\ErrorInterface', $exception); - $this->assertInstanceOf('Predis\Response\ObjectInterface', $exception); + $this->assertInstanceOf('Predis\Response\ResponseInterface', $exception); $this->assertInstanceOf('Predis\PredisException', $exception); } diff --git a/tests/Predis/Response/StatusTest.php b/tests/Predis/Response/StatusTest.php index d5f9a4a1..825f45de 100644 --- a/tests/Predis/Response/StatusTest.php +++ b/tests/Predis/Response/StatusTest.php @@ -25,7 +25,7 @@ class StatusTest extends PredisTestCase { $status = new Status('OK'); - $this->assertInstanceOf('Predis\Response\ObjectInterface', $status); + $this->assertInstanceOf('Predis\Response\ResponseInterface', $status); $this->assertSame('OK', $status->getPayload()); }