Browse Source

Move method to the base Predis\Network\ConnectionBase class.

Daniele Alessandri 14 years ago
parent
commit
503cc86f7d

+ 8 - 0
lib/Predis/Network/ConnectionBase.php

@@ -71,6 +71,14 @@ abstract class ConnectionBase implements IConnectionSingle {
         return $this->readResponse($command);
     }
 
+    public function readResponse(ICommand $command) {
+        $reply = $this->read();
+        if (isset($reply->skipParse)) {
+            return $reply;
+        }
+        return $command->parseResponse($reply);
+    }
+
     protected function onCommunicationException($message, $code = null) {
         Utils::onCommunicationException(
             new CommunicationException($this, $message, $code)

+ 0 - 5
lib/Predis/Network/PhpiredisConnection.php

@@ -253,9 +253,4 @@ class PhpiredisConnection extends ConnectionBase {
         array_unshift($cmdargs, $command->getId());
         $this->write(phpiredis_format_command($cmdargs));
     }
-
-    public function readResponse(ICommand $command) {
-        $reply = $this->read();
-        return isset($reply->skipParse) ? $reply : $command->parseResponse($reply);
-    }
 }

+ 0 - 5
lib/Predis/Network/StreamConnection.php

@@ -194,9 +194,4 @@ class StreamConnection extends ConnectionBase {
         }
         $this->write($buffer);
     }
-
-    public function readResponse(ICommand $command) {
-        $reply = $this->read();
-        return isset($reply->skipParse) ? $reply : $command->parseResponse($reply);
-    }
 }