本文整理汇总了PHP中owa_coreAPI::metricFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::metricFactory方法的具体用法?PHP owa_coreAPI::metricFactory怎么用?PHP owa_coreAPI::metricFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::metricFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadMetrics
function _loadMetrics()
{
foreach ($this->modules as $k => $module) {
if (is_array($module->metrics)) {
$this->metrics = array_merge_recursive($this->metrics, $module->metrics);
}
}
$metricsByEntityMap = array();
foreach ($this->metrics as $metric => $implementations) {
foreach ($implementations as $implementation) {
$m = owa_coreAPI::metricFactory($implementation['class'], $implementation['params']);
if (!$m->isCalculated()) {
$metricsByEntityMap[$m->getEntityName()][$implementation['name']] = $implementation;
}
}
}
$this->setMap('metricsByEntity', $metricsByEntityMap);
}
示例2: getAllRelatedMetrics
function getAllRelatedMetrics($entity)
{
$related_metrics = array();
$s = owa_coreAPI::serviceSingleton();
$all_metrics = $s->getAllMetrics();
$entity_name = $entity->getName();
$s = owa_coreAPI::serviceSingleton();
$metricsByEntity = $s->getMap('metricsByEntity');
foreach ($all_metrics as $metric_name => $implementations) {
foreach ($implementations as $implementation) {
$m = owa_coreAPI::metricFactory($implementation['class'], $implementation['params']);
if ($m->isCalculated()) {
$children = $m->getChildMetrics();
$error = false;
foreach ($children as $child) {
if (!isset($metricsByEntity[$entity_name][$child])) {
$error = true;
}
}
if (!$error) {
$related_metrics[$implementation['group']][] = array('name' => $metric_name, 'label' => $implementation['label'], 'description' => $implementation['description'], 'group' => $implementation['group']);
continue;
}
} else {
if ($entity_name === $m->getEntityName()) {
$related_metrics[$implementation['group']][] = array('name' => $metric_name, 'label' => $implementation['label'], 'description' => $implementation['description'], 'group' => $implementation['group']);
continue;
}
}
}
}
return $related_metrics;
}