WordPress at a glance
function is not described

WC_REST_Data_Controller::prepare_item_for_response() public WC 1.0

Prepare a data resource object for serialization.

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

No Hooks.

Return

WP_REST_Response. $response Response data.

Usage

$WC_REST_Data_Controller = new WC_REST_Data_Controller();
$WC_REST_Data_Controller->prepare_item_for_response( $resource, $request );
$resource(stdClass) (required)
Resource data.
$request(WP_REST_Request) (required)
Request object.

Code of WC_REST_Data_Controller::prepare_item_for_response() WC 5.0.0

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

	$data = $this->add_additional_fields_to_object( $data, $request );
	$data = $this->filter_response_by_context( $data, 'view' );

	// Wrap the data in a response object.
	$response = rest_ensure_response( $data );
	$response->add_links( $this->prepare_links( $resource ) );

	return $response;
}