Example #1
0
 /**
  * @description Create table with plain OOP and aggregate it
  */
 public function benchAggregatePlainPhp()
 {
     $table = new Table(array(new Row(array('key' => new Cell('a'), 'num' => new Cell(10), 'rand' => new Cell(rand(0, 100000)))), new Row(array('key' => new Cell('a'), 'num' => new Cell(10))), new Row(array('key' => new Cell('b'), 'num' => new Cell(10)))));
     $table->partition(function ($row) {
         return $row['num'];
     })->fork(function ($table, $newTable) {
         $row = $newTable->createAndAddRow();
         $row->set('num', $table->getColumn('num')->sum());
     });
 }