Automattic\WooCommerce\Internal\CLI\Migrator\Core

CredentialManager::readlineprivateWC 1.0

Reads a line from STDIN.

A backward-compatible wrapper for WP_CLI::readline().

Method of the class: CredentialManager{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->readline( $prompt ): string;
$prompt(string) (required)
The prompt to show to the user.

CredentialManager::readline() code WC 10.7.0

private function readline( string $prompt ): string {
	if ( method_exists( 'WP_CLI', 'readline' ) ) {
		return WP_CLI::readline( $prompt );
	}

	WP_CLI::line( $prompt );
	return trim( fgets( STDIN ) );
}