* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * Select component spellcheck result * * @package Solarium * @subpackage Result */ class Solarium_Result_Select_Spellcheck implements IteratorAggregate, Countable { /** * Suggestions array * * @var array */ protected $_suggestions; /** * Collation object * * @var Solarium_Result_Select_Spellcheck_Collation */ protected $_collation; /** * Correctly spelled? * * @var boolean */ protected $_correctlySpelled; /** * Constructor * * @param array $suggestions * @param Solarium_Result_Select_Spellcheck_Collation $collation * @param boolean $correctlySpelled * @return void */ public function __construct($suggestions, $collation, $correctlySpelled) { $this->_suggestions = $suggestions; $this->_collation = $collation; $this->_correctlySpelled = $correctlySpelled; } /** * Get the collation result * * @return Solarium_Result_Select_Spellcheck_Collation */ public function getCollation() { return $this->_collation; } /** * Get correctly spelled status * * Only available if ExtendedResults was enabled in your query * * @return bool */ public function getCorrectlySpelled() { return $this->_correctlySpelled; } /** * Get a result by key * * @param mixed $key * @return Solarium_Result_Select_Highlighting_Suggestion|null */ public function getSuggestion($key) { if (isset($this->_suggestions[$key])) { return $this->_suggestions[$key]; } else { return null; } } /** * Get all suggestions * * @return array */ public function getSuggestions() { return $this->_suggestions; } /** * IteratorAggregate implementation * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_suggestions); } /** * Countable implementation * * @return int */ public function count() { return count($this->_suggestions); } }