public function __construct(array $nodes, array $config = [], Api $api = NULL)
{
// wash any custom keys if any
$this->nodes = array_values($nodes);
$this->setActiveNodeIndex($this->pickNode());
if (!empty($config)) {
// use php array merge so passed in config overrides defaults
$this->config = array_merge($this->config, $config);
}
if ($api) {
$this->api = $api;
} else {
// default to HTTP bridge class
$this->api = new Http($this->config);
}
}