WordPress at a glance
function is not described

WC_REST_System_Status_V2_Controller::format_plugin_data() protected WC 3.6.0

Format plugin data, including data on updates, into a standard format.

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

No Hooks.

Return

Array. Formatted data.

Usage

// protected - for code of main (parent) or child class
$result = $this->format_plugin_data( $plugin, $data );
$plugin(string) (required)
Plugin directory/file.
$data(array) (required)
Plugin data from WP.

Changelog

Since 3.6.0 Introduced.

Code of WC_REST_System_Status_V2_Controller::format_plugin_data() WC 5.0.0

<?php
protected function format_plugin_data( $plugin, $data ) {
	require_once ABSPATH . 'wp-admin/includes/update.php';

	if ( ! function_exists( 'get_plugin_updates' ) ) {
		return array();
	}

	// Use WP API to lookup latest updates for plugins. WC_Helper injects updates for premium plugins.
	if ( empty( $this->available_updates ) ) {
		$this->available_updates = get_plugin_updates();
	}

	$version_latest = $data['Version'];

	// Find latest version.
	if ( isset( $this->available_updates[ $plugin ]->update->new_version ) ) {
		$version_latest = $this->available_updates[ $plugin ]->update->new_version;
	}

	return array(
		'plugin'            => $plugin,
		'name'              => $data['Name'],
		'version'           => $data['Version'],
		'version_latest'    => $version_latest,
		'url'               => $data['PluginURI'],
		'author_name'       => $data['AuthorName'],
		'author_url'        => esc_url_raw( $data['AuthorURI'] ),
		'network_activated' => $data['Network'],
	);
}