WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators

Controller::get_analytics_report_data() public WC 1.0

Get analytics report data and endpoints.

{} Это метод класса: Controller{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$Controller = new Controller();
$Controller->get_analytics_report_data();

Код Controller::get_analytics_report_data() WC 4.7.1

<?php
public function get_analytics_report_data() {
	$request  = new \WP_REST_Request( 'GET', '/wc-analytics/reports' );
	$response = rest_do_request( $request );

	if ( is_wp_error( $response ) ) {
		return $response;
	}

	if ( 200 !== $response->get_status() ) {
		return new \WP_Error( 'woocommerce_analytics_performance_indicators_result_failed', __( 'Sorry, fetching performance indicators failed.', 'woocommerce' ) );
	}

	$endpoints = $response->get_data();

	foreach ( $endpoints as $endpoint ) {
		if ( '/stats' === substr( $endpoint['slug'], -6 ) ) {
			$request  = new \WP_REST_Request( 'OPTIONS', $endpoint['path'] );
			$response = rest_do_request( $request );

			if ( is_wp_error( $response ) ) {
				return $response;
			}

			$data = $response->get_data();

			$prefix = substr( $endpoint['slug'], 0, -6 );

			if ( empty( $data['schema']['properties']['totals']['properties'] ) ) {
				continue;
			}

			foreach ( $data['schema']['properties']['totals']['properties'] as $property_key => $schema_info ) {
				if ( empty( $schema_info['indicator'] ) || ! $schema_info['indicator'] ) {
					continue;
				}

				$stat                   = $prefix . '/' . $property_key;
				$this->allowed_stats[]  = $stat;
				$stat_label             = empty( $schema_info['title'] ) ? $schema_info['description'] : $schema_info['title'];
				$this->labels[ $stat ]  = trim( $stat_label, '.' );
				$this->formats[ $stat ] = isset( $schema_info['format'] ) ? $schema_info['format'] : 'number';
			}

			$this->endpoints[ $prefix ] = $endpoint['path'];
			$this->urls[ $prefix ]      = $endpoint['_links']['report'][0]['href'];
		}
	}
}