Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors
OptionRuleProcessor::validate()
Validates the rule.
Method of the class: OptionRuleProcessor{}
No Hooks.
Return
true|false
. Pass/fail.
Usage
$OptionRuleProcessor = new OptionRuleProcessor(); $OptionRuleProcessor->validate( $rule );
- $rule(object) (required)
- The rule to validate.
OptionRuleProcessor::validate() OptionRuleProcessor::validate code WC 9.8.2
public function validate( $rule ) { if ( ! isset( $rule->option_name ) ) { return false; } if ( ! isset( $rule->value ) ) { return false; } if ( ! isset( $rule->operation ) ) { return false; } if ( isset( $rule->transformers ) && is_array( $rule->transformers ) ) { foreach ( $rule->transformers as $transform_args ) { $transformer = TransformerService::create_transformer( $transform_args->use ); if ( ! $transformer->validate( $transform_args->arguments ) ) { return false; } } } return true; }