Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Webflow

WebflowMapper::add_unique_imageprivateWC 1.0

Append an image entry to $images keyed by URL, deduping repeats.

Method of the class: WebflowMapper{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->add_unique_image( $images, $by_url, $entry ): void;
$images(array) (required)
Image list (mutated).
$by_url(array) (required)
URL => index map (mutated).
$entry(array) (required)
The image entry to add.

WebflowMapper::add_unique_image() code WC 11.0.0

private function add_unique_image( array &$images, array &$by_url, array $entry ): void {
	$url = $entry['src'];
	if ( isset( $by_url[ $url ] ) ) {
		return;
	}
	$by_url[ $url ] = count( $images );
	$images[]       = $entry;
}