Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog

AsyncGenerator::update_feed_progressprivateWC 1.0

Updates the feed progress while the feed is being generated.

Method of the class: AsyncGenerator{}

No Hooks.

Returns

Array. Updated status of the feed generation.

Usage

// private - for code of main (parent) class only
$result = $this->update_feed_progress( $status, $progress ): array;
$status(array) (required)
The last previously known status.
$progress(WalkerProgress) (required)
The progress of the walker.

AsyncGenerator::update_feed_progress() code WC 10.8.1

private function update_feed_progress( array $status, WalkerProgress $progress ): array {
	$status['progress']  = $progress->total_count > 0
		? round( ( $progress->processed_items / $progress->total_count ) * 100, 2 )
		: 0;
	$status['processed'] = $progress->processed_items;
	$status['total']     = $progress->total_count;
	return $status;
}