Automattic\WooCommerce\Internal\CLI\Migrator\Commands
ResetCommand::__invoke
Resets (deletes) the credentials for a given platform.
OPTIONS
- [--platform=<platform>]
- The platform to reset credentials for. Defaults to
'shopify'.
EXAMPLES
wp wc migrate reset
Method of the class: ResetCommand{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ResetCommand = new ResetCommand(); $ResetCommand->__invoke( $args, $assoc_args );
- $args(array) (required)
- Positional arguments.
- $assoc_args(array) (required)
- Associative arguments.
ResetCommand::__invoke() ResetCommand:: invoke code WC 10.8.1
public function __invoke( array $args, array $assoc_args ) {
// Resolve and validate the platform.
$platform = $this->platform_registry->resolve_platform( $assoc_args );
$platform_display_name = $this->platform_registry->get_platform_display_name( $platform );
if ( ! $this->credential_manager->has_credentials( $platform ) ) {
WP_CLI::warning( "No credentials found for '{$platform_display_name}' to reset." );
return;
}
$this->credential_manager->delete_credentials( $platform );
WP_CLI::success( "Credentials for the '{$platform_display_name}' platform have been cleared." );
}