WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats

Segmenter::get_order_related_intervals_segments() protected WC 1.0

Calculate segments for intervals query where the segmenting property is bound to order (e.g. coupon or customer type).

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

No Hooks.

Return

Array. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_order_related_intervals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $intervals_query );
$segmenting_select(string) (required)
SELECT part of segmenting SQL query.
$segmenting_from(string) (required)
FROM part of segmenting SQL query.
$segmenting_where(string) (required)
WHERE part of segmenting SQL query.
$segmenting_groupby(string) (required)
GROUP BY part of segmenting SQL query.
$table_name(string) (required)
Name of SQL table which is the stats table for orders.
$intervals_query(array) (required)
Array of SQL clauses for intervals query.

Code of Segmenter::get_order_related_intervals_segments() WC 5.2.2

<?php
protected function get_order_related_intervals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $intervals_query ) {
	global $wpdb;
	$segmenting_limit = '';
	$limit_parts      = explode( ',', $intervals_query['limit'] );
	if ( 2 === count( $limit_parts ) ) {
		$orig_rowcount    = intval( $limit_parts[1] );
		$segmenting_limit = $limit_parts[0] . ',' . $orig_rowcount * count( $this->get_all_segments() );
	}

	$intervals_segments = $wpdb->get_results(
		"SELECT
					MAX($table_name.date_created) AS datetime_anchor,
					{$intervals_query['select_clause']} AS time_interval,
					$segmenting_groupby
					$segmenting_select
				FROM
					$table_name
					$segmenting_from
					{$intervals_query['from_clause']}
				WHERE
					1=1
					{$intervals_query['where_time_clause']}
					{$intervals_query['where_clause']}
					$segmenting_where
				GROUP BY
					time_interval, $segmenting_groupby
				$segmenting_limit",
		ARRAY_A
	); // WPCS: cache ok, DB call ok, unprepared SQL ok.

	// Reformat result.
	$intervals_segments = $this->reformat_intervals_segments( $intervals_segments, $segmenting_groupby );
	return $intervals_segments;
}