Reworked a bit the internals of Predis\Client::create().

This commit is contained in:
Daniele Alessandri
2009-11-28 13:20:01 +01:00
parent 6bd7ef9217
commit 45be8e6385
+7 -5
View File
@@ -34,20 +34,22 @@ class Client {
$argv = func_get_args();
$argc = func_num_args();
$client = new Client();
if ($argc == 1) {
$client->setConnection($client->createConnection($argv[0]));
return new Client($argv[0]);
}
else if ($argc > 1) {
$client = new Client();
$cluster = new ConnectionCluster();
foreach ($argv as $parameters) {
// TODO: this is a bit dirty...
$cluster->add($client->createConnection($parameters));
}
$client->setConnection($cluster);
return $client;
}
else {
return new Client();
}
return $client;
}
private function createConnection($parameters) {