Made the constructor method of Predis\Client more flexible with the passed arguments.

This commit is contained in:
Daniele Alessandri
2009-11-28 13:09:49 +01:00
parent bb81971d71
commit 6bd7ef9217
+6 -2
View File
@@ -17,9 +17,13 @@ class Client {
public function __construct($host = Connection::DEFAULT_HOST, $port = Connection::DEFAULT_PORT) {
$this->_pipelining = false;
$connectionParams = new ConnectionParameters(array('host' => $host, 'port' => $port));
$this->_connection = new Connection($connectionParams);
$this->_registeredCommands = self::initializeDefaultCommands();
$this->setConnection($this->createConnection(
func_num_args() === 1 && is_array($host) || @stripos('redis://') === 0
? $host
: array('host' => $host, 'port' => $port)
));
}
public function __destruct() {