當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Row::setColumns方法代碼示例

本文整理匯總了PHP中Piwik\DataTable\Row::setColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP Row::setColumns方法的具體用法?PHP Row::setColumns怎麽用?PHP Row::setColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\DataTable\Row的用法示例。


在下文中一共展示了Row::setColumns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: test_hasColumn

 public function test_hasColumn()
 {
     $this->row->setColumns(array('test1' => 'yes', 'test2' => false, 'test3' => 5, 'test4' => array()));
     $this->assertFalse($this->row->hasColumn('test'));
     // does not exist
     $this->assertTrue($this->row->hasColumn('test1'));
     $this->assertTrue($this->row->hasColumn('test2'));
     // even if value is false it still exists
     $this->assertTrue($this->row->hasColumn('test3'));
     $this->assertTrue($this->row->hasColumn('test4'));
 }
開發者ID:cemo,項目名稱:piwik,代碼行數:11,代碼來源:RowTest.php

示例3: getCompetitionDatatable

 /**
  * Returns a custom data table.
  * This data table will be converted to all available formats
  * when requested in the API request.
  *
  * @return DataTable
  */
 public function getCompetitionDatatable()
 {
     $dataTable = new DataTable();
     $row1 = new Row();
     $row1->setColumns(array('name' => 'piwik', 'license' => 'GPL'));
     // Rows Metadata is useful to store non stats data for example (logos, urls, etc.)
     // When printed out, they are simply merged with columns
     $row1->setMetadata('logo', 'logo.png');
     $dataTable->addRow($row1);
     $dataTable->addRowFromSimpleArray(array('name' => 'google analytics', 'license' => 'commercial'));
     return $dataTable;
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:19,代碼來源:API.php


注:本文中的Piwik\DataTable\Row::setColumns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。