1<?php 2 3namespace Elastica\Connection\Strategy; 4 5use Elastica\Connection; 6use Elastica\Exception\ClientException; 7 8/** 9 * Description of SimpleStrategy. 10 * 11 * @author chabior 12 */ 13class Simple implements StrategyInterface 14{ 15 /** 16 * {@inheritdoc} 17 */ 18 public function getConnection(array $connections): Connection 19 { 20 foreach ($connections as $connection) { 21 if ($connection->isEnabled()) { 22 return $connection; 23 } 24 } 25 26 throw new ClientException('No enabled connection'); 27 } 28} 29