mirror of
https://github.com/predis/predis.git
synced 2026-09-17 22:07:04 +00:00
Reworked a bit the internals of Predis\Client::create().
This commit is contained in:
+7
-5
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user