Automattic\WooCommerce\Internal\CLI\Migrator\Core

PlatformRegistry::load_platformsprivateWC 1.0

Loads platforms discovered via a filter.

It also validates that each registered platform provides both a fetcher and a mapper class.

Method of the class: PlatformRegistry{}

Hooks from the method

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->load_platforms(): void;

PlatformRegistry::load_platforms() code WC 10.8.1

private function load_platforms(): void {
	/**
	 * Filters the list of registered migration platforms.
	 *
	 * External platform plugins should hook into this filter to register themselves.
	 * Each platform plugin is responsible for its own autoloading and initialization.
	 *
	 * @param array $platforms An associative array of platform configurations.
	 *                         Each key is a unique platform ID (e.g., 'shopify'), and the value
	 *                         is another array containing 'name', 'fetcher', and 'mapper' class names.
	 * @since 1.0.0
	 */
	$platforms = apply_filters( 'woocommerce_migrator_platforms', array() );

	if ( ! is_array( $platforms ) ) {
		return;
	}

	foreach ( $platforms as $platform_id => $config ) {
		// Validate that required keys exist and have valid values.
		if ( isset( $config['fetcher'], $config['mapper'] ) &&
			is_string( $config['fetcher'] ) && ! empty( $config['fetcher'] ) &&
			is_string( $config['mapper'] ) && ! empty( $config['mapper'] ) ) {
			$this->platforms[ $platform_id ] = $config;
		}
	}
}