Browse Source

Rename base response interface to Predis\Response\ResponseInterface.

Daniele Alessandri 11 years ago
parent
commit
ee45de4f0e

+ 2 - 1
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`.

+ 3 - 3
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);
             }
 

+ 1 - 1
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);

+ 1 - 1
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);

+ 1 - 1
lib/Predis/Response/ErrorInterface.php

@@ -17,7 +17,7 @@ namespace Predis\Response;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ErrorInterface extends ObjectInterface
+interface ErrorInterface extends ResponseInterface
 {
     /**
      * Returns the error message

+ 1 - 1
lib/Predis/Response/Iterator/MultiBulkIterator.php

@@ -27,7 +27,7 @@ use Predis\Response;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-abstract class MultiBulkIterator implements Iterator, Countable, Response\ObjectInterface
+abstract class MultiBulkIterator implements Iterator, Countable, Response\ResponseInterface
 {
     protected $current;
     protected $position;

+ 2 - 2
lib/Predis/Response/ObjectInterface.php → 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 <suppakilla@gmail.com>
  */
-interface ObjectInterface
+interface ResponseInterface
 {
 }

+ 1 - 1
lib/Predis/Response/Status.php

@@ -16,7 +16,7 @@ namespace Predis\Response;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class Status implements ObjectInterface
+class Status implements ResponseInterface
 {
     private static $OK;
     private static $QUEUED;

+ 1 - 1
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())

+ 1 - 1
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);
     }
 
     /**

+ 1 - 1
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);
     }
 

+ 1 - 1
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());
     }