当前位置: 首页>>代码示例>>PHP>>正文


PHP Row::getColumnsRaw方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:43,代码来源:Row.php


注:本文中的Piwik\DataTable\Row::getColumnsRaw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。