本文整理匯總了PHP中Piwik\DataTable\Row::sumRowMetadata方法的典型用法代碼示例。如果您正苦於以下問題:PHP Row::sumRowMetadata方法的具體用法?PHP Row::sumRowMetadata怎麽用?PHP Row::sumRowMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\DataTable\Row
的用法示例。
在下文中一共展示了Row::sumRowMetadata方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_sumRowMetadata_uniquearraymergeShouldUseArrayFromThisRow_IfNoMetadataForOtherRowSpecified
public function test_sumRowMetadata_uniquearraymergeShouldUseArrayFromThisRow_IfNoMetadataForOtherRowSpecified()
{
$row = $this->getTestRowWithNoSubDataTable();
$arrayValue = array(array('test' => 3, 'value' => 3), array('test' => 2, 'value' => 2));
$this->row->setMetadata('my_array', $arrayValue);
$aggregations = array('my_array' => 'uniquearraymerge');
$this->row->sumRowMetadata($row, $aggregations);
$this->assertSame(array('my_array' => $arrayValue), $this->row->getMetadata());
}
示例2: testSumRowMetadata_CustomAggregationOperation
public function testSumRowMetadata_CustomAggregationOperation()
{
$metadata1 = array('mytest' => 'value1');
$metadata2 = array('mytest' => 'value2');
$self = $this;
$row1 = new Row(array(Row::COLUMNS => array('test_int' => 145), Row::METADATA => $metadata1));
$finalRow = new Row(array(Row::COLUMNS => array('test_int' => 5), Row::METADATA => $metadata2));
$finalRow->sumRowMetadata($row1, array('mytest' => function ($thisValue, $otherValue, $thisRow, $otherRow) use($self, $row1, $finalRow) {
$self->assertEquals('value2', $thisValue);
$self->assertEquals('value1', $otherValue);
$self->assertSame($thisRow, $finalRow);
$self->assertSame($otherRow, $row1);
if (!is_array($thisValue)) {
$thisValue = array($thisValue);
}
$thisValue[] = $otherValue;
return $thisValue;
}));
$this->assertEquals(array('value2', 'value1'), $finalRow->getMetadata('mytest'));
}