Automattic\WooCommerce\Internal\CLI\Migrator\Core

CredentialManager::prompt_for_credentialspublicWC 1.0

Prompts the user for credentials via the command line.

Method of the class: CredentialManager{}

No Hooks.

Returns

Array. The collected credentials.

Usage

$CredentialManager = new CredentialManager();
$CredentialManager->prompt_for_credentials( $fields ): array;
$fields(array) (required)
An associative array of fields to prompt for.

CredentialManager::prompt_for_credentials() code WC 10.7.0

public function prompt_for_credentials( array $fields ): array {
	$credentials = array();
	foreach ( $fields as $key => $prompt ) {
		$credentials[ $key ] = $this->readline( $prompt . ' ' );
	}

	return $credentials;
}