* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Result */ /** * Select component debug timing result * * @package Solarium * @subpackage Result */ class Solarium_Result_Select_Debug_Timing implements IteratorAggregate, Countable { /** * Time * * @var float */ protected $_time; /** * Timing phase array * * @var array */ protected $_phases; /** * Constructor * * @param float $time * @param array $phases * @return void */ public function __construct($time, $phases) { $this->_time = $time; $this->_phases = $phases; } /** * Get total time * * @return float */ public function getTime() { return $this->_time; } /** * Get a timing phase by key * * @param mixed $key * @return Solarium_Result_Select_Debug_TimingPhase|null */ public function getPhase($key) { if (isset($this->_phases[$key])) { return $this->_phases[$key]; } else { return null; } } /** * Get timings * * @return array */ public function getPhases() { return $this->_phases; } /** * IteratorAggregate implementation * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_phases); } /** * Countable implementation * * @return int */ public function count() { return count($this->_phases); } }