Exemplo n.º 1
0
 private function setupConnection($parameters)
 {
     if ($parameters !== null && !(is_array($parameters) || is_string($parameters))) {
         throw new ClientException('Invalid parameters type (array or string expected)');
     }
     if (is_array($parameters) && isset($parameters[0])) {
         $cluster = new ConnectionCluster();
         foreach ($parameters as $shardParams) {
             $cluster->add($this->createConnection($shardParams));
         }
         $this->setConnection($cluster);
     } else {
         $this->setConnection($this->createConnection($parameters));
     }
 }
Exemplo n.º 2
0
 private function setupConnection($parameters)
 {
     //echo"setupConnection: ";var_dump($parameters);echo "<br>";
     if ($parameters !== null && !(is_array($parameters) || is_string($parameters))) {
         throw new ClientException('Invalid parameters type (array or string expected)');
     }
     if (is_array($parameters) && isset($parameters[0])) {
         $cluster = new ConnectionCluster($this->_options->key_distribution);
         foreach ($parameters as $shardParams) {
             $cluster->add($this->createConnection($shardParams));
         }
         $this->setConnection($cluster);
     } else {
         $this->setConnection($this->createConnection($parameters));
     }
 }