WordPress at a glance
function is not described

WP_REST_Application_Passwords_Controller::prepare_item_for_response() public WP 5.6.0

Prepares the application password for the REST response.

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

Hooks from the method
Return

WP_REST_Response|WP_Error. Response object on success, or WP_Error object on failure.

Usage

$WP_REST_Application_Passwords_Controller = new WP_REST_Application_Passwords_Controller();
$WP_REST_Application_Passwords_Controller->prepare_item_for_response( $item, $request );
$item(array) (required)
WordPress representation of the item.
$request(WP_REST_Request) (required)
Request object.

Changelog

Since 5.6.0 Introduced.

Code of WP_REST_Application_Passwords_Controller::prepare_item_for_response() WP 5.7.2

<?php
public function prepare_item_for_response( $item, $request ) {
	$user = $this->get_user( $request );

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

	$prepared = array(
		'uuid'      => $item['uuid'],
		'app_id'    => empty( $item['app_id'] ) ? '' : $item['app_id'],
		'name'      => $item['name'],
		'created'   => gmdate( 'Y-m-d\TH:i:s', $item['created'] ),
		'last_used' => $item['last_used'] ? gmdate( 'Y-m-d\TH:i:s', $item['last_used'] ) : null,
		'last_ip'   => $item['last_ip'] ? $item['last_ip'] : null,
	);

	if ( isset( $item['new_password'] ) ) {
		$prepared['password'] = $item['new_password'];
	}

	$prepared = $this->add_additional_fields_to_object( $prepared, $request );
	$prepared = $this->filter_response_by_context( $prepared, $request['context'] );

	$response = new WP_REST_Response( $prepared );
	$response->add_links( $this->prepare_links( $user, $item ) );

	/**
	 * Filters the REST API response for an application password.
	 *
	 * @since 5.6.0
	 *
	 * @param WP_REST_Response $response The response object.
	 * @param array            $item     The application password array.
	 * @param WP_REST_Request  $request  The request object.
	 */
	return apply_filters( 'rest_prepare_application_password', $response, $item, $request );
}