WordPress at a glance
function is not described

WC_REST_Customers_Controller::get_formatted_item_data() protected WC 3.0.0

Get formatted item data.

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

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_formatted_item_data( $object );
$object(WC_Data) (required)
WC_Data instance.

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_Customers_Controller::get_formatted_item_data() WC 5.0.0

<?php
protected function get_formatted_item_data( $object ) {
	$data        = $object->get_data();
	$format_date = array( 'date_created', 'date_modified' );

	// Format date values.
	foreach ( $format_date as $key ) {
		// Date created is stored UTC, date modified is stored WP local time.
		$datetime              = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[ $key ]->getTimestamp() ) ) : $data[ $key ];
		$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
		$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
	}

	return array(
		'id'                 => $object->get_id(),
		'date_created'       => $data['date_created'],
		'date_created_gmt'   => $data['date_created_gmt'],
		'date_modified'      => $data['date_modified'],
		'date_modified_gmt'  => $data['date_modified_gmt'],
		'email'              => $data['email'],
		'first_name'         => $data['first_name'],
		'last_name'          => $data['last_name'],
		'role'               => $data['role'],
		'username'           => $data['username'],
		'billing'            => $data['billing'],
		'shipping'           => $data['shipping'],
		'is_paying_customer' => $data['is_paying_customer'],
		'avatar_url'         => $object->get_avatar_url(),
		'meta_data'          => $data['meta_data'],
	);
}