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