auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -7,58 +7,25 @@ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Admin\DeprecatedClassFacade;
|
||||
|
||||
/**
|
||||
* Rule processor that negates the rules in the rule's operand.
|
||||
*
|
||||
* @deprecated 8.8.0
|
||||
*/
|
||||
class NotRuleProcessor implements RuleProcessorInterface {
|
||||
class NotRuleProcessor extends DeprecatedClassFacade {
|
||||
/**
|
||||
* The name of the non-deprecated class that this facade covers.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\NotRuleProcessor';
|
||||
|
||||
/**
|
||||
* The rule evaluator to use.
|
||||
* The version that this class was deprecated in.
|
||||
*
|
||||
* @var RuleEvaluator
|
||||
* @var string
|
||||
*/
|
||||
protected $rule_evaluator;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param RuleEvaluator $rule_evaluator The rule evaluator to use.
|
||||
*/
|
||||
public function __construct( $rule_evaluator = null ) {
|
||||
$this->rule_evaluator = null === $rule_evaluator
|
||||
? new RuleEvaluator()
|
||||
: $rule_evaluator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the rules in the operand and negates the result.
|
||||
*
|
||||
* @param object $rule The specific rule being processed by this rule processor.
|
||||
* @param object $stored_state Stored state.
|
||||
*
|
||||
* @return bool The result of the operation.
|
||||
*/
|
||||
public function process( $rule, $stored_state ) {
|
||||
$evaluated_operand = $this->rule_evaluator->evaluate(
|
||||
$rule->operand,
|
||||
$stored_state
|
||||
);
|
||||
|
||||
return ! $evaluated_operand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the rule.
|
||||
*
|
||||
* @param object $rule The rule to validate.
|
||||
*
|
||||
* @return bool Pass/fail.
|
||||
*/
|
||||
public function validate( $rule ) {
|
||||
if ( ! isset( $rule->operand ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
protected static $deprecated_in_version = '8.8.0';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user