本文整理汇总了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;
}