original_string: public function aggregateDataTableRecords($recordNames,
                                                $maximumRowsInDataTableLevelZero = null,
                                                $maximumRowsInSubDataTable = null,
                                                $columnToSortByBeforeTruncation = null,
                                                &$columnsAggregationOperation = null,
                                                $columnsToRenameAfterAggregation = null,
                                                $countRowsRecursive = true)
      {
          if (!is_array($recordNames)) {
              $recordNames = array($recordNames);
          }
  
          $nameToCount = array();
          foreach ($recordNames as $recordName) {
              $latestUsedTableId = Manager::getInstance()->getMostRecentTableId();
  
              $table = $this->aggregateDataTableRecord($recordName, $columnsAggregationOperation, $columnsToRenameAfterAggregation);
  
              $nameToCount[$recordName]['level0'] = $table->getRowsCount();
              if ($countRowsRecursive === true || (is_array($countRowsRecursive) && in_array($recordName, $countRowsRecursive))) {
                  $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive();
              }
  
              $blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
              Common::destroy($table);
              $this->insertBlobRecord($recordName, $blob);
  
              unset($blob);
              DataTable\Manager::getInstance()->deleteAll($latestUsedTableId);
          }
  
          return $nameToCount;
      }
code: public function aggregateDataTableRecords($recordNames,
                                                $maximumRowsInDataTableLevelZero = null,
                                                $maximumRowsInSubDataTable = null,
                                                $columnToSortByBeforeTruncation = null,
                                                &$columnsAggregationOperation = null,
                                                $columnsToRenameAfterAggregation = null,
                                                $countRowsRecursive = true)
      {
          if (!is_array($recordNames)) {
              $recordNames = array($recordNames);
          }
  
          $nameToCount = array();
          foreach ($recordNames as $recordName) {
              $latestUsedTableId = Manager::getInstance()->getMostRecentTableId();
  
              $table = $this->aggregateDataTableRecord($recordName, $columnsAggregationOperation, $columnsToRenameAfterAggregation);
  
              $nameToCount[$recordName]['level0'] = $table->getRowsCount();
              if ($countRowsRecursive === true || (is_array($countRowsRecursive) && in_array($recordName, $countRowsRecursive))) {
                  $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive();
              }
  
              $blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
              Common::destroy($table);
              $this->insertBlobRecord($recordName, $blob);
  
              unset($blob);
              DataTable\Manager::getInstance()->deleteAll($latestUsedTableId);
          }
  
          return $nameToCount;
      }
code_tokens: public function aggregateDataTableRecords ( $ recordNames , $ maximumRowsInDataTableLevelZero = null , $ maximumRowsInSubDataTable = null , $ columnToSortByBeforeTruncation = null , & $ columnsAggregationOperation = null , $ columnsToRenameAfterAggregation = null , $ countRowsRecursive = true ) { if ( ! is_array ( $ recordNames ) ) { $ recordNames = array ( $ recordNames ) ; } $ nameToCount = array ( ) ; foreach ( $ recordNames as $ recordName ) { $ latestUsedTableId = Manager :: getInstance ( ) -> getMostRecentTableId ( ) ; $ table = $ this -> aggregateDataTableRecord ( $ recordName , $ columnsAggregationOperation , $ columnsToRenameAfterAggregation ) ; $ nameToCount [ $ recordName ] [ 'level0' ] = $ table -> getRowsCount ( ) ; if ( $ countRowsRecursive === true || ( is_array ( $ countRowsRecursive ) && in_array ( $ recordName , $ countRowsRecursive ) ) ) { $ nameToCount [ $ recordName ] [ 'recursive' ] = $ table -> getRowsCountRecursive ( ) ; } $ blob = $ table -> getSerialized ( $ maximumRowsInDataTableLevelZero , $ maximumRowsInSubDataTable , $ columnToSortByBeforeTruncation ) ; Common :: destroy ( $ table ) ; $ this -> insertBlobRecord ( $ recordName , $ blob ) ; unset ( $ blob ) ; DataTable \ Manager :: getInstance ( ) -> deleteAll ( $ latestUsedTableId ) ; } return $ nameToCount ; }
docstring: Sums records for every subperiod of the current period and inserts the result as the record
  for this period.
  
  DataTables are summed recursively so subtables will be summed as well.
  
  @param string|array $recordNames Name(s) of the report we are aggregating, eg, `'Referrers_type'`.
  @param int $maximumRowsInDataTableLevelZero Maximum number of rows allowed in the top level DataTable.
  @param int $maximumRowsInSubDataTable Maximum number of rows allowed in each subtable.
  @param string $columnToSortByBeforeTruncation The name of the column to sort by before truncating a DataTable.
  @param array $columnsAggregationOperation Operations for aggregating columns, see {@link Row::sumRow()}.
  @param array $columnsToRenameAfterAggregation Columns mapped to new names for columns that must change names
  when summed because they cannot be summed, eg,
  `array('nb_uniq_visitors' => 'sum_daily_nb_uniq_visitors')`.
  @param bool|array $countRowsRecursive if set to true, will calculate the recursive rows count for all record names
  which makes it slower. If you only need it for some records pass an array of
  recordNames that defines for which ones you need a recursive row count.
  @return array Returns the row counts of each aggregated report before truncation, eg,
  
  array(
  'report1' => array('level0' => $report1->getRowsCount,
  'recursive' => $report1->getRowsCountRecursive()),
  'report2' => array('level0' => $report2->getRowsCount,
  'recursive' => $report2->getRowsCountRecursive()),
  ...
  )
  @api
docstring_tokens: Sums records for every subperiod of the current period and inserts the result as the record for this period .