本文整理汇总了PHP中Varien_Profiler::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Profiler::getType方法的具体用法?PHP Varien_Profiler::getType怎么用?PHP Varien_Profiler::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Profiler
的用法示例。
在下文中一共展示了Varien_Profiler::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTree
/**
* Render tree (recursive function)
*
* @param array $data
* @return string
*/
public function renderTree(array $data)
{
$helper = Mage::helper('aoe_profiler');
/* @var $helper Aoe_Profiler_Helper_Data */
$output = '';
foreach ($data as $key => $uniqueId) {
if (strpos($key, '_children') === false) {
$tmp = $this->stackLog[$uniqueId];
$hasChildren = isset($data[$key . '_children']) && count($data[$key . '_children']) > 0;
$duration = round($tmp['time_total'] * 1000);
$output .= '<li duration="' . $duration . '" class="' . ($tmp['level'] > 1 ? 'collapsed' : '') . ' level-' . $tmp['level'] . ' ' . ($hasChildren ? 'has-children' : '') . '">';
$output .= '<div class="info">';
$output .= '<div class="profiler-label">';
if ($hasChildren) {
$output .= '<div class="toggle profiler-open"> </div>';
$output .= '<div class="toggle profiler-closed"> </div>';
}
$label = end($tmp['stack']);
if (isset($tmp['detail'])) {
$label .= ' (' . htmlspecialchars($tmp['detail']) . ')';
}
$type = Varien_Profiler::getType($tmp['type'], $label);
$output .= '<span class="caption type-' . $type . '" title="' . htmlspecialchars($label) . '" />';
if (isset($tmp['file'])) {
$remoteCallUrlTemplate = Mage::getStoreConfig('dev/debug/remoteCallUrlTemplate');
$linkTemplate = '<a href="%s" onclick="var ajax = new XMLHttpRequest(); ajax.open(\'GET\', this.href); ajax.send(null); return false">%s</a>';
$url = sprintf($remoteCallUrlTemplate, $tmp['file'], intval($tmp['line']));
$output .= sprintf($linkTemplate, $url, htmlspecialchars($label));
} else {
$output .= htmlspecialchars($label);
}
$output .= '</span>';
$output .= '</div>';
// class="label"
$output .= '<div class="profiler-columns">';
foreach ($this->metrics as $metric) {
$formatterMethod = 'format_' . $metric;
$ownTitle = 'Own: ' . $helper->{$formatterMethod}($tmp[$metric . '_own']) . ' ' . $this->units[$metric] . ' / ' . round($tmp[$metric . '_rel_own'] * 100, 2) . '%';
$subTitle = 'Sub: ' . $helper->{$formatterMethod}($tmp[$metric . '_sub']) . ' ' . $this->units[$metric] . ' / ' . round($tmp[$metric . '_rel_sub'] * 100, 2) . '%';
$totalTitle = $helper->{$formatterMethod}($tmp[$metric . '_own'] + $tmp[$metric . '_sub']) . ' ' . $this->units[$metric] . ' / ' . round(($tmp[$metric . '_rel_own'] + $tmp[$metric . '_rel_sub']) * 100, 2) . '%';
$fullTitle = $totalTitle . ' (' . $ownTitle . ', ' . $subTitle . ')';
$output .= '<div class="metric" title="' . $fullTitle . '">';
$progressBar = $this->renderProgressBar($tmp[$metric . '_rel_own'] * 100, $tmp[$metric . '_rel_sub'] * 100, $tmp[$metric . '_rel_offset'] * 100);
$output .= '<div class="' . $metric . ' profiler-column">' . $progressBar . '</div>';
$output .= '</div>';
// class="metric"
}
$output .= '</div>';
// class="profiler-columns"
$output .= '</div>';
// class="info"
if ($hasChildren) {
$output .= '<ul>' . $this->renderTree($data[$key . '_children']) . '</ul>';
}
$output .= '</li>';
}
}
return $output;
}
示例2: getType
/**
* Get type icon
*
* @param $type
* @param $label
* @return string
*/
protected function getType($type, $label)
{
$type = Varien_Profiler::getType($type, $label);
if (!isset($this->typeIcons[$type])) {
$type = Varien_Profiler::TYPE_DEFAULT;
}
return $type;
}