WordPress at a glance
function is not described

WC_REST_Report_Products_Totals_Controller::get_reports() protected WC 3.5.0

Get reports list.

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

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_reports();

Changelog

Since 3.5.0 Introduced.

Code of WC_REST_Report_Products_Totals_Controller::get_reports() WC 5.0.0

<?php
protected function get_reports() {
	$types = wc_get_product_types();
	$terms = get_terms(
		array(
			'taxonomy'   => 'product_type',
			'hide_empty' => false,
		)
	);
	$data  = array();

	foreach ( $terms as $product_type ) {
		if ( ! isset( $types[ $product_type->name ] ) ) {
			continue;
		}

		$data[] = array(
			'slug'  => $product_type->name,
			'name'  => $types[ $product_type->name ],
			'total' => (int) $product_type->count,
		);
	}

	return $data;
}