Predis\Connection\Factory::aggregate PHP Метод

aggregate() публичный Метод

public aggregate ( Predis\Connection\AggregateConnectionInterface $connection, array $parameters )
$connection Predis\Connection\AggregateConnectionInterface
$parameters array
    public function aggregate(AggregateConnectionInterface $connection, array $parameters)
    {
        foreach ($parameters as $node) {
            $connection->add($node instanceof NodeConnectionInterface ? $node : $this->create($node));
        }
    }

Usage Example

Пример #1
0
 /**
  * @group disconnected
  */
 public function testConstructorWithReplicationArgument()
 {
     $replication = new Connection\Aggregate\MasterSlaveReplication();
     $factory = new Connection\Factory();
     $factory->aggregate($replication, array('tcp://host1?alias=master', 'tcp://host2?alias=slave'));
     $client = new Client($replication);
     $this->assertInstanceOf('Predis\\Connection\\Aggregate\\ReplicationInterface', $client->getConnection());
     $this->assertSame($replication, $client->getConnection());
 }