* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * Select component facetset result * * @package Solarium * @subpackage Result */ class Solarium_Result_Select_FacetSet implements IteratorAggregate, Countable { /** * Facet array * * @var array */ protected $_facets; /** * Constructor * * @param array $facets * @return void */ public function __construct($facets) { $this->_facets = $facets; } /** * Get a facet by key * * @param mixed $key * @return mixed */ public function getFacet($key) { if (isset($this->_facets[$key])) { return $this->_facets[$key]; } else { return null; } } /** * Get all results * * @return array */ public function getFacets() { return $this->_facets; } /** * IteratorAggregate implementation * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_facets); } /** * Countable implementation * * @return int */ public function count() { return count($this->_facets); } }