diff --git a/lib/Predis/Client.php b/lib/Predis/Client.php index 60c2986d..83f2c3d5 100644 --- a/lib/Predis/Client.php +++ b/lib/Predis/Client.php @@ -108,7 +108,7 @@ class Client implements ClientInterface $replication = isset($options->replication) && $options->replication; $connection = $options->{$replication ? 'replication' : 'cluster'}; - $options->connections->createAggregated($connection, $parameters); + $options->connections->aggregate($connection, $parameters); return $connection; } diff --git a/lib/Predis/Connection/ConnectionFactory.php b/lib/Predis/Connection/ConnectionFactory.php index 36bffb34..6587b0f6 100644 --- a/lib/Predis/Connection/ConnectionFactory.php +++ b/lib/Predis/Connection/ConnectionFactory.php @@ -128,13 +128,11 @@ class ConnectionFactory implements ConnectionFactoryInterface /** * {@inheritdoc} */ - public function createAggregated(AggregatedConnectionInterface $connection, Array $parameters) + public function aggregate(AggregatedConnectionInterface $connection, Array $parameters) { foreach ($parameters as $node) { $connection->add($node instanceof SingleConnectionInterface ? $node : $this->create($node)); } - - return $connection; } /** diff --git a/lib/Predis/Connection/ConnectionFactoryInterface.php b/lib/Predis/Connection/ConnectionFactoryInterface.php index 0ac6be7c..e5ded18a 100644 --- a/lib/Predis/Connection/ConnectionFactoryInterface.php +++ b/lib/Predis/Connection/ConnectionFactoryInterface.php @@ -43,11 +43,10 @@ interface ConnectionFactoryInterface public function create($parameters); /** - * Prepares an aggregation of connection objects. + * Aggregates single connections into an aggregate connection instance. * * @param AggregatedConnectionInterface $cluster Instance of an aggregated connection class. * @param array $parameters List of parameters for each connection object. - * @return AggregatedConnectionInterface */ - public function createAggregated(AggregatedConnectionInterface $cluster, Array $parameters); + public function aggregate(AggregatedConnectionInterface $cluster, Array $parameters); } diff --git a/tests/Predis/ClientTest.php b/tests/Predis/ClientTest.php index 0ec5db56..4d83dd9b 100644 --- a/tests/Predis/ClientTest.php +++ b/tests/Predis/ClientTest.php @@ -173,7 +173,7 @@ class ClientTest extends StandardTestCase $cluster = new PredisCluster(); $factory = new ConnectionFactory(); - $factory->createAggregated($cluster, array('tcp://localhost:7000', 'tcp://localhost:7001')); + $factory->aggregate($cluster, array('tcp://localhost:7000', 'tcp://localhost:7001')); $client = new Client($cluster); @@ -189,7 +189,7 @@ class ClientTest extends StandardTestCase $replication = new MasterSlaveReplication(); $factory = new ConnectionFactory(); - $factory->createAggregated($replication, array('tcp://host1?alias=master', 'tcp://host2?alias=slave')); + $factory->aggregate($replication, array('tcp://host1?alias=master', 'tcp://host2?alias=slave')); $client = new Client($replication); diff --git a/tests/Predis/Connection/ConnectionFactoryTest.php b/tests/Predis/Connection/ConnectionFactoryTest.php index 99867d9d..ca37bbe6 100644 --- a/tests/Predis/Connection/ConnectionFactoryTest.php +++ b/tests/Predis/Connection/ConnectionFactoryTest.php @@ -304,7 +304,7 @@ class ConnectionFactoryTest extends StandardTestCase $factory->expects($this->never()) ->method('create'); - $factory->createAggregated($cluster, array(new $connectionClass(), new $connectionClass())); + $factory->aggregate($cluster, array(new $connectionClass(), new $connectionClass())); } /** @@ -326,7 +326,7 @@ class ConnectionFactoryTest extends StandardTestCase return new $connectionClass; })); - $factory->createAggregated($cluster, array(null, 'tcp://127.0.0.1', array('scheme' => 'tcp'), new $connectionClass())); + $factory->aggregate($cluster, array(null, 'tcp://127.0.0.1', array('scheme' => 'tcp'), new $connectionClass())); } /** @@ -340,7 +340,7 @@ class ConnectionFactoryTest extends StandardTestCase $factory = $this->getMock('Predis\Connection\ConnectionFactory', array('create')); $factory->expects($this->never())->method('create'); - $factory->createAggregated($cluster, array()); + $factory->aggregate($cluster, array()); } /** @@ -363,7 +363,7 @@ class ConnectionFactoryTest extends StandardTestCase })); $nodes = array('tcp://127.0.0.1:7001?password=foo', 'tcp://127.0.0.1:7002?password=bar'); - $factory->createAggregated($cluster, $nodes); + $factory->aggregate($cluster, $nodes); }