Automattic\WooCommerce\Admin\RemoteInboxNotifications

OnboardingProfileRuleProcessor::process()publicWC 1.0

Performs a comparison operation against a value in the onboarding profile.

Method of the class: OnboardingProfileRuleProcessor{}

No Hooks.

Return

true|false. The result of the operation.

Usage

$OnboardingProfileRuleProcessor = new OnboardingProfileRuleProcessor();
$OnboardingProfileRuleProcessor->process( $rule, $stored_state );
$rule(object) (required)
The rule being processed by this rule processor.
$stored_state(object) (required)
Stored state.

OnboardingProfileRuleProcessor::process() code WC 8.7.0

public function process( $rule, $stored_state ) {
	$onboarding_profile = get_option( 'woocommerce_onboarding_profile' );

	if ( empty( $onboarding_profile ) || ! is_array( $onboarding_profile ) ) {
		return false;
	}

	if ( ! isset( $onboarding_profile[ $rule->index ] ) ) {
		return false;
	}

	return ComparisonOperation::compare(
		$onboarding_profile[ $rule->index ],
		$rule->value,
		$rule->operation
	);
}