Automattic\WooCommerce\Internal\ProductFeed\Storage

JsonFileFeed::generate_file_nameprivateWC 1.0

Generate the feed file name based on the base name and the current time.

Method of the class: JsonFileFeed{}

Hooks from the method

Returns

String. The feed file name.

Usage

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

JsonFileFeed::generate_file_name() code WC 11.0.1

private function generate_file_name(): string {
	/**
	 * Allows the current time to be overridden before a feed is stored.
	 *
	 * @param int           $time The current time.
	 * @param FeedInterface $feed The feed instance.
	 * @return int The current time.
	 * @since 10.5.0
	 */
	$current_time = apply_filters( 'woocommerce_product_feed_time', time(), $this );
	$hash_data    = $this->base_name . gmdate( 'r', $current_time );

	return sprintf(
		'%s-%s-%s.json',
		$this->base_name,
		gmdate( 'Y-m-d', $current_time ),
		wp_hash( $hash_data )
	);
}