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


PHP Row::sumRow方法代码示例

本文整理汇总了PHP中Piwik\DataTable\Row::sumRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Row::sumRow方法的具体用法?PHP Row::sumRow怎么用?PHP Row::sumRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\DataTable\Row的用法示例。


在下文中一共展示了Row::sumRow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_SumRow_shouldIgnoreCallableValues_AndNotRaiseAnyException

 public function test_SumRow_shouldIgnoreCallableValues_AndNotRaiseAnyException()
 {
     $columns = array('nb_visits' => 5, 'label' => 'Test', 'closure' => function () {
         return 7;
     });
     $this->row->setColumns($columns);
     $secondRow = new Row(array(Row::COLUMNS => $columns));
     $this->row->sumRow($secondRow);
     $this->assertEquals(10, $this->row->getColumn('nb_visits'));
     $this->assertEquals(7, $this->row->getColumn('closure'));
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:11,代码来源:RowTest.php

示例2: addRow

 /**
  * Adds a row to this table.
  *
  * If {@link setMaximumAllowedRows()} was called and the current row count is
  * at the maximum, the new row will be summed to the summary row. If there is no summary row,
  * this row is set as the summary row.
  *
  * @param Row $row
  * @return Row `$row` or the summary row if we're at the maximum number of rows.
  */
 public function addRow(Row $row)
 {
     // if there is a upper limit on the number of allowed rows and the table is full,
     // add the new row to the summary row
     if ($this->maximumAllowedRows > 0 && $this->getRowsCount() >= $this->maximumAllowedRows - 1) {
         if ($this->summaryRow === null) {
             // create the summary row if necessary
             $columns = array('label' => self::LABEL_SUMMARY_ROW) + $row->getColumns();
             $this->addSummaryRow(new Row(array(Row::COLUMNS => $columns)));
         } else {
             $this->summaryRow->sumRow($row, $enableCopyMetadata = false, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME));
         }
         return $this->summaryRow;
     }
     $this->rows[] = $row;
     if (!$this->indexNotUpToDate && $this->rebuildIndexContinuously) {
         $label = $row->getColumn('label');
         if ($label !== false) {
             $this->rowsIndexByLabel[$label] = count($this->rows) - 1;
         }
     }
     return $row;
 }
开发者ID:piwik,项目名称:piwik,代码行数:33,代码来源:DataTable.php

示例3: testSumRow_stringException

 /**
  * Test that adding two string column values results in an exception.
  */
 public function testSumRow_stringException()
 {
     $columns = array('super' => array('this column has an array string that will be 0 when algorithm sums the value'));
     $row1 = new Row(array(Row::COLUMNS => $columns));
     $columns2 = array('super' => array('this column has geagaean array value, amazing'));
     $row2 = new Row(array(Row::COLUMNS => $columns2));
     $row2->sumRow($row1);
     $this->assertTrue($noException = true);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:12,代码来源:DataTableTest.php

示例4: addSummaryRow

 private function addSummaryRow($table)
 {
     $table->filter('Sort', array($this->columnToSortByBeforeTruncating, 'desc'));
     if ($table->getRowsCount() <= $this->truncateAfter + 1) {
         return;
     }
     $rows = $table->getRows();
     $count = $table->getRowsCount();
     $newRow = new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW)));
     for ($i = $this->truncateAfter; $i < $count; $i++) {
         if (!isset($rows[$i])) {
             // case when the last row is a summary row, it is not indexed by $cout but by DataTable::ID_SUMMARY_ROW
             $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
             //FIXME: I'm not sure why it could return false, but it was reported in: http://forum.piwik.org/read.php?2,89324,page=1#msg-89442
             if ($summaryRow) {
                 $newRow->sumRow($summaryRow, $enableCopyMetadata = false, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME));
             }
         } else {
             $newRow->sumRow($rows[$i], $enableCopyMetadata = false, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME));
         }
     }
     $table->filter('Limit', array(0, $this->truncateAfter));
     $table->addSummaryRow($newRow);
     unset($rows);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:25,代码来源:Truncate.php

示例5: testSumRow_stringException

 /**
  * Test that adding two string column values results in an exception.
  *
  * @group Core
  *
  * @expectedException Exception
  */
 public function testSumRow_stringException()
 {
     $columns = array('super' => array('this column has an array string that will be 0 when algorithm sums the value'));
     $row1 = new Row(array(Row::COLUMNS => $columns));
     $columns2 = array('super' => array('this column has geagaean array value, amazing'));
     $row2 = new Row(array(Row::COLUMNS => $columns2));
     $row2->sumRow($row1);
     $this->fail("sumRow did not throw when adding two string columns.");
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:16,代码来源:DataTableTest.php


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