* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * Select component grouping result * * @since 2.1.0 * * @package Solarium * @subpackage Result */ class Solarium_Result_Select_Grouping implements IteratorAggregate, Countable { /** * Group results array * * @var array */ protected $_groups; /** * Constructor * * @param array $groups * @return void */ public function __construct($groups) { $this->_groups = $groups; } /** * Get all groups * * @return array */ public function getGroups() { return $this->_groups; } /** * Get a group * * @param string $key * @return Solarium_Result_Select_Grouping_FieldGroup|Solarium_Result_Select_Grouping_QueryGroup */ public function getGroup($key) { if (isset($this->_groups[$key])) { return $this->_groups[$key]; } else { return null; } } /** * IteratorAggregate implementation * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_groups); } /** * Countable implementation * * @return int */ public function count() { return count($this->_groups); } }