WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports

Segmenter::assign_segments_to_intervals() protected WC 1.0

Assign segments to time intervals by updating original $intervals array.

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

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->assign_segments_to_intervals( $intervals, $intervals_segments );
$intervals(array) (required)
Result array from intervals SQL query.
$intervals_segments(array) (required)
Result array from interval segments SQL query.

Code of Segmenter::assign_segments_to_intervals() WC 5.3.0

<?php
protected function assign_segments_to_intervals( &$intervals, $intervals_segments ) {
	$old_keys = array_keys( $intervals );
	foreach ( $intervals as $interval ) {
		$intervals[ $interval['time_interval'] ]             = $interval;
		$intervals[ $interval['time_interval'] ]['segments'] = array();
	}
	foreach ( $old_keys as $key ) {
		unset( $intervals[ $key ] );
	}

	foreach ( $intervals_segments as $time_interval => $segment ) {
		if ( isset( $intervals[ $time_interval ] ) ) {
			$intervals[ $time_interval ]['segments'] = $segment['segments'];
		}
	}
	// To remove time interval keys (so that REST response is formatted correctly).
	$intervals = array_values( $intervals );
}