本文整理汇总了PHP中Piwik\DataTable\Row::getColumnsRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Row::getColumnsRaw方法的具体用法?PHP Row::getColumnsRaw怎么用?PHP Row::getColumnsRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable\Row
的用法示例。
在下文中一共展示了Row::getColumnsRaw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sumRow
/**
* Sums the given `$rowToSum` columns values to the existing row column values.
* Only the int or float values will be summed. Label columns will be ignored
* even if they have a numeric value.
*
* Columns in `$rowToSum` that don't exist in `$this` are added to `$this`.
*
* @param \Piwik\DataTable\Row $rowToSum The row to sum to this row.
* @param bool $enableCopyMetadata Whether metadata should be copied or not.
* @param array $aggregationOperations for columns that should not be summed, determine which
* aggregation should be used (min, max). format:
* `array('column name' => 'function name')`
*/
public function sumRow(Row $rowToSum, $enableCopyMetadata = true, $aggregationOperations = false)
{
foreach ($rowToSum->getColumnsRaw() as $columnToSumName => $columnToSumValue) {
if (!$this->isSummableColumn($columnToSumName)) {
continue;
}
if ($this->isColumnValueCallable($columnToSumValue)) {
$this->setColumn($columnToSumName, $columnToSumValue);
continue;
}
$thisColumnValue = $this->getColumn($columnToSumName);
$operation = 'sum';
if (is_array($aggregationOperations) && isset($aggregationOperations[$columnToSumName])) {
$operation = strtolower($aggregationOperations[$columnToSumName]);
}
// max_actions is a core metric that is generated in ArchiveProcess_Day. Therefore, it can be
// present in any data table and is not part of the $aggregationOperations mechanism.
if ($columnToSumName == Metrics::INDEX_MAX_ACTIONS) {
$operation = 'max';
}
if (empty($operation)) {
throw new Exception("Unknown aggregation operation for column {$columnToSumName}.");
}
$newValue = $this->getColumnValuesMerged($operation, $thisColumnValue, $columnToSumValue);
$this->setColumn($columnToSumName, $newValue);
}
if ($enableCopyMetadata) {
$this->sumRowMetadata($rowToSum);
}
}