當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。