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

This commit is contained in:
Daniele Alessandri
2010-06-10 11:47:09 +02:00
parent e191d0a7ce
commit 1fd715e7a5
+6 -1
View File
@@ -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;
}