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

WC_REST_Reports_V1_Controller::prepare_item_for_response() public WC 1.0

Prepare a report object for serialization.

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

Хуки из метода
Возвращает

WP_REST_Response. $response Response data.

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

$WC_REST_Reports_V1_Controller = new WC_REST_Reports_V1_Controller();
$WC_REST_Reports_V1_Controller->prepare_item_for_response( $report, $request );
$report(stdClass) (обязательный)
Report data.
$request(WP_REST_Request) (обязательный)
Request object.

Код WC_REST_Reports_V1_Controller::prepare_item_for_response() WC 4.7.1

<?php
public function prepare_item_for_response( $report, $request ) {
	$data = array(
		'slug'        => $report->slug,
		'description' => $report->description,
	);

	$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
	$data = $this->add_additional_fields_to_object( $data, $request );
	$data = $this->filter_response_by_context( $data, $context );

	// Wrap the data in a response object.
	$response = rest_ensure_response( $data );
	$response->add_links( array(
		'self' => array(
			'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $report->slug ) ),
		),
		'collection' => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
	) );

	/**
	 * Filter a report returned from the API.
	 *
	 * Allows modification of the report data right before it is returned.
	 *
	 * @param WP_REST_Response $response The response object.
	 * @param object           $report   The original report object.
	 * @param WP_REST_Request  $request  Request used to generate the response.
	 */
	return apply_filters( 'woocommerce_rest_prepare_report', $response, $report, $request );
}