public function aggregate(StatsTableBuilder $statsTable) { // Use sum $sumValueAggregation = new SumAggregation($this->valueInternalName); $sumOverAggregation = new SumAggregation($this->overInternalName); $sumValue = $sumValueAggregation->aggregate($statsTable); $sumOver = $sumOverAggregation->aggregate($statsTable); return $sumOver ? $sumValue / $sumOver : $sumValue; }
public function testAggregation() { $statsTable = $this->getSampleTable(); $hitsSum = new SumAggregation('hits'); $this->assertEquals(40, $hitsSum->aggregate($statsTable)); }