Automattic\WooCommerce\Internal\Admin

OrderMilestoneEasterEgg::get_cached_milestone_order_idsprivateWC 1.0

Returns cached milestone order IDs, or null when the cache is missing.

Method of the class: OrderMilestoneEasterEgg{}

No Hooks.

Returns

Array. int>|null

Usage

// private - for code of main (parent) class only
$result = $this->get_cached_milestone_order_ids(): ?array;

OrderMilestoneEasterEgg::get_cached_milestone_order_ids() code WC 10.9.1

private function get_cached_milestone_order_ids(): ?array {
	$cached = get_option( self::MILESTONE_CACHE_OPTION, null );
	if ( ! is_array( $cached ) ) {
		return null;
	}

	$milestone_order_ids = array();
	foreach ( self::MILESTONE_POSITIONS as $key ) {
		if ( isset( $cached[ $key ] ) ) {
			$order_id = absint( $cached[ $key ] );
			if ( $order_id > 0 ) {
				$milestone_order_ids[ $key ] = $order_id;
			}
		}
	}

	return $milestone_order_ids;
}