Automattic\WooCommerce\Admin

ReportCSVExporter::get_report_controllerpublic staticWC 11.0.1

Get a REST controller instance for a given report type, or false if unknown.

Method of the class: ReportCSVExporter{}

No Hooks.

Returns

\WC_REST_Reports_Controller|false.

Usage

$result = ReportCSVExporter::get_report_controller( $report_type );
$report_type(string) (required)
Report type. E.g. 'orders'.

Changelog

Since 11.0.1 Introduced.

ReportCSVExporter::get_report_controller() code WC 11.0.1

public static function get_report_controller( $report_type ) {
	$controller_map = self::get_report_controller_map();

	if ( ! isset( $controller_map[ $report_type ] ) ) {
		return false;
	}

	$controller = new $controller_map[ $report_type ]();

	return $controller instanceof \WC_REST_Reports_Controller ? $controller : false;
}