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


PHP Row::getColumns方法代码示例

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


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

示例1: test_getColumns_shouldNotConvertNullValuesToFalse

 public function test_getColumns_shouldNotConvertNullValuesToFalse()
 {
     $this->row->setColumns(array('nb_visits' => null, 'label' => 'Test', 'closure' => function () {
         return null;
     }, 'boolean' => false));
     $expected = array('nb_visits' => null, 'label' => 'Test', 'closure' => null, 'boolean' => false);
     $this->assertSame($expected, $this->row->getColumns());
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:8,代码来源:RowTest.php

示例2: test_getColumns_setColumns_shouldReturnAllColumns

 public function test_getColumns_setColumns_shouldReturnAllColumns()
 {
     $this->row->setColumns(array('nb_visits' => 4, 'label' => 'Test', 'goals' => array(1 => array())));
     $expected = array('nb_visits' => 4, 'label' => 'Test', 'goals' => array(1 => array()));
     $this->assertEquals($expected, $this->row->getColumns());
     $this->assertEquals('Test', $this->row->getColumn('label'));
     $this->assertEquals(4, $this->row->getColumn('nb_visits'));
 }
开发者ID:cemo,项目名称:piwik,代码行数:8,代码来源:RowTest.php

示例3: addRow

 private function addRow(DataTable $table, DataTable\Row $row, $growthPercentage, $newValue, $oldValue, $difference, $disappeared = false, $isNew = false, $isMover = false)
 {
     $columns = $row->getColumns();
     $columns['growth_percent'] = $growthPercentage;
     $columns['growth_percent_numeric'] = str_replace('%', '', $growthPercentage);
     $columns['grown'] = '-' != substr($growthPercentage, 0, 1);
     $columns['value_old'] = $oldValue;
     $columns['value_new'] = $newValue;
     $columns['difference'] = $difference;
     $columns['importance'] = abs($difference);
     $columns['isDisappeared'] = $disappeared;
     $columns['isNew'] = $isNew;
     $columns['isMover'] = $isMover;
     $table->addRowFromArray(array(DataTable\Row::COLUMNS => $columns));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:15,代码来源:Insight.php

示例4: 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

示例5: testRow

 /**
  * Simple test of the DataTable_Row
  */
 public function testRow()
 {
     $columns = array('test_column' => 145, 92582495 => new Timer(), 'super' => array('this column has an array value, amazing'));
     $metadata = array('logo' => 'piwik.png', 'super' => array('this column has an array value, amazing'));
     $arrayRow = array(Row::COLUMNS => $columns, Row::METADATA => $metadata, 'fake useless key' => 38959, 43905724897 => 'value');
     $row = new Row($arrayRow);
     $this->assertEquals($columns, $row->getColumns());
     $this->assertEquals($metadata, $row->getMetadata());
     $this->assertNull($row->getIdSubDataTable());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:DataTableTest.php

示例6: isEqual

 /**
  * Helper function that tests if two rows are equal.
  *
  * Two rows are equal if:
  *
  * - they have exactly the same columns / metadata
  * - they have a subDataTable associated, then we check that both of them are the same.
  *
  * Column order is not important.
  *
  * @param \Piwik\DataTable\Row $row1 first to compare
  * @param \Piwik\DataTable\Row $row2 second to compare
  * @return bool
  */
 public static function isEqual(Row $row1, Row $row2)
 {
     //same columns
     $cols1 = $row1->getColumns();
     $cols2 = $row2->getColumns();
     $diff1 = array_udiff($cols1, $cols2, array(__CLASS__, 'compareElements'));
     $diff2 = array_udiff($cols2, $cols1, array(__CLASS__, 'compareElements'));
     if ($diff1 != $diff2) {
         return false;
     }
     $dets1 = $row1->getMetadata();
     $dets2 = $row2->getMetadata();
     ksort($dets1);
     ksort($dets2);
     if ($dets1 != $dets2) {
         return false;
     }
     // either both are null
     // or both have a value
     if (!(is_null($row1->getIdSubDataTable()) && is_null($row2->getIdSubDataTable()))) {
         $subtable1 = $row1->getSubtable();
         $subtable2 = $row2->getSubtable();
         if (!DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:42,代码来源:Row.php

示例7: assertRowEquals

 private function assertRowEquals($expectedColumns, $expectedSiteIdInMetadata, Row $row)
 {
     $this->assertEquals($expectedColumns, $row->getColumns());
     $this->assertEquals(array('idsite' => $expectedSiteIdInMetadata), $row->getMetadata());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:5,代码来源:DataTableFactoryTest.php


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