本文整理汇总了PHP中Timer::getTimes方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::getTimes方法的具体用法?PHP Timer::getTimes怎么用?PHP Timer::getTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::getTimes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCapturesTimes
public function testCapturesTimes()
{
$this->timer->begin([]);
$this->timer->begin(['1']);
$this->timer->begin(['1', 'a']);
$this->timer->end(['1']);
$this->timer->end([]);
$times = $this->timer->getTimes();
$begin = Timer::MARKER_BEGIN;
$end = Timer::MARKER_END;
$this->assertEquals([$begin, 1, $end], array_keys($times));
$this->assertEquals([$begin, 'a', $end], array_keys($times[1]));
$this->assertEquals([$begin], array_keys($times[1]['a']));
$this->assertIsATime($times[$begin]);
$this->assertIsATime($times[1][$begin]);
$this->assertIsATime($times[1]['a'][$begin]);
$this->assertIsATime($times[1][$end]);
$this->assertIsATime($times[$end]);
}
示例2: buildTree
/**
* Return a tree of time periods from a Timer
*
* @param Timer $timer Timer object
* @return array
*/
public function buildTree(Timer $timer)
{
$times = $timer->getTimes();
if (!isset($times[':end'])) {
$times[':end'] = microtime();
}
$begin = $this->findBeginTime($times);
$end = $this->findEndTime($times);
$this->total = $this->diffMicrotime($begin, $end);
return $this->analyzePeriod('', $times);
}