Browse Source

Prepare to return the appropriate instance of Predis\IConnectionSingle based on the URI scheme.

Daniele Alessandri 15 years ago
parent
commit
1fd715e7a5
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lib/Predis.php

+ 6 - 1
lib/Predis.php

@@ -113,7 +113,7 @@ class Client {
 
     private function createConnection($parameters) {
         $params     = new ConnectionParameters($parameters);
-        $connection = new TcpConnection($params, $this->_responseReader);
+        $connection = $this->createConnectionInstance($params);
 
         if ($params->password !== null) {
             $connection->pushInitCommand($this->createCommand(
@@ -129,6 +129,11 @@ class Client {
         return $connection;
     }
 
+    private function createConnectionInstance(ConnectionParameters $parameters) {
+        // TODO: check scheme and return the appropriate IConnectionSingle instance
+        return new TcpConnection($parameters, $this->_responseReader);
+    }
+
     private function setConnection(IConnection $connection) {
         $this->_connection = $connection;
     }