WC_REST_WCCOM_Site_Installer_Controller::map_state_to_response()protectedWC 1.0

Map the installation state to a response.

Method of the class: WC_REST_WCCOM_Site_Installer_Controller{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->map_state_to_response( $state );
$state(WC_WCCOM_Site_Installation_State) (required)
The installation state.

WC_REST_WCCOM_Site_Installer_Controller::map_state_to_response() code WC 9.4.2

protected function map_state_to_response( $state ) {
	return array(
		'product_id'                    => $state->get_product_id(),
		'idempotency_key'               => $state->get_idempotency_key(),
		'last_step_name'                => $state->get_last_step_name(),
		'last_step_status'              => $state->get_last_step_status(),
		'last_step_error'               => $state->get_last_step_error(),
		'product_type'                  => $state->get_product_type(),
		'product_name'                  => $state->get_product_name(),
		'already_installed_plugin_info' => $state->get_already_installed_plugin_info(),
		'started_seconds_ago'           => time() - $state->get_started_date(),
	);
}