WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Variations\Stats

Segmenter::get_segments() protected WC 1.0

Return array of segments formatted for REST response.

{} 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_segments( $type, $query_params, $table_name );
$type(string) (required)
Type of segments to return--'totals' or 'intervals'.
$query_params(array) (required)
SQL query parameter array.
$table_name(string) (required)
Name of main SQL table for the data store (used as basis for JOINS).

Code of Segmenter::get_segments() WC 5.2.2

<?php
protected function get_segments( $type, $query_params, $table_name ) {
	global $wpdb;
	if ( ! isset( $this->query_args['segmentby'] ) || '' === $this->query_args['segmentby'] ) {
		return array();
	}

	$product_segmenting_table = $wpdb->prefix . 'wc_order_product_lookup';
	$unique_orders_table      = 'uniq_orders';
	$segmenting_where         = '';

	// Product, variation, and category are bound to product, so here product segmenting table is required,
	// while coupon and customer are bound to order, so we don't need the extra JOIN for those.
	// This also means that segment selections need to be calculated differently.
	if ( 'variation' === $this->query_args['segmentby'] ) {
		$product_level_columns     = $this->get_segment_selections_product_level( $product_segmenting_table );
		$segmenting_selections     = array(
			'product_level' => $this->prepare_selections( $product_level_columns ),
		);
		$this->report_columns      = $product_level_columns;
		$segmenting_from           = '';
		$segmenting_groupby        = $product_segmenting_table . '.variation_id';
		$segmenting_dimension_name = 'variation_id';

		// Restrict our search space for variation comparisons.
		if ( isset( $this->query_args['variation_includes'] ) ) {
			$variation_ids    = implode( ',', $this->get_all_segments() );
			$segmenting_where = " AND $product_segmenting_table.variation_id IN ( $variation_ids )";
		}

		$segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table );
	}

	return $segments;
}