本文整理匯總了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'));
}
示例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'));
}
示例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;
}