WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports

Segmenter::reformat_intervals_segments() protected WC 1.0

Update row-level db result for segments in 'intervals' section to the format used for output.

{} It's a method of the class: Segmenter{}

No Hooks.

Return

Array. Reformatted array.

Usage

// protected - for code of main (parent) or child class
$result = $this->reformat_intervals_segments( $segments_db_result, $segment_dimension );
$segments_db_result(array) (required)
Results from the SQL db query for segmenting.
$segment_dimension(string) (required)
Name of column used for grouping the result.

Code of Segmenter::reformat_intervals_segments() WC 5.3.0

<?php
protected function reformat_intervals_segments( $segments_db_result, $segment_dimension ) {
	$aggregated_segment_result = array();

	if ( strpos( $segment_dimension, '.' ) ) {
		$segment_dimension = substr( strstr( $segment_dimension, '.' ), 1 );
	}

	$segment_labels = $this->get_segment_labels();

	foreach ( $segments_db_result as $segment_data ) {
		$segment_id = $segment_data[ $segment_dimension ];
		if ( ! isset( $segment_labels[ $segment_id ] ) ) {
			continue;
		}

		$time_interval = $segment_data['time_interval'];
		if ( ! isset( $aggregated_segment_result[ $time_interval ] ) ) {
			$aggregated_segment_result[ $time_interval ]             = array();
			$aggregated_segment_result[ $time_interval ]['segments'] = array();
		}
		unset( $segment_data['time_interval'] );
		unset( $segment_data['datetime_anchor'] );
		unset( $segment_data[ $segment_dimension ] );
		$segment_datum = array(
			'segment_label' => $segment_labels[ $segment_id ],
			'segment_id'    => $segment_id,
			'subtotals'     => $segment_data,
		);
		$aggregated_segment_result[ $time_interval ]['segments'][ $segment_id ] = $segment_datum;
	}

	return $aggregated_segment_result;
}