Automattic\WooCommerce\Internal\CLI\Migrator\Core

CredentialManager::get_credentialspublicWC 1.0

Retrieves the stored credentials for a given platform.

Method of the class: CredentialManager{}

No Hooks.

Returns

Array|null. An associative array of credentials, or null if not found.

Usage

$CredentialManager = new CredentialManager();
$CredentialManager->get_credentials( $platform_slug ): ?array;
$platform_slug(string) (required)
The slug for the platform.

CredentialManager::get_credentials() code WC 10.8.1

public function get_credentials( string $platform_slug ): ?array {
	$option_name      = "wc_migrator_credentials_{$platform_slug}";
	$credentials_json = get_option( $option_name, false );
	if ( ! $credentials_json ) {
		return null;
	}

	$credentials = json_decode( $credentials_json, true );

	return is_array( $credentials ) ? $credentials : null;
}