本文整理匯總了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);
}