auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -9,53 +9,25 @@ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Notes\Notes;
|
||||
use Automattic\WooCommerce\Admin\DeprecatedClassFacade;
|
||||
|
||||
/**
|
||||
* Rule processor that compares against the status of another note.
|
||||
*
|
||||
* @deprecated 8.8.0
|
||||
*/
|
||||
class NoteStatusRuleProcessor implements RuleProcessorInterface {
|
||||
class NoteStatusRuleProcessor extends DeprecatedClassFacade {
|
||||
/**
|
||||
* Compare against the status of another note.
|
||||
* The name of the non-deprecated class that this facade covers.
|
||||
*
|
||||
* @param object $rule The rule being processed by this rule processor.
|
||||
* @param object $stored_state Stored state.
|
||||
*
|
||||
* @return bool The result of the operation.
|
||||
* @var string
|
||||
*/
|
||||
public function process( $rule, $stored_state ) {
|
||||
$status = Notes::get_note_status( $rule->note_name );
|
||||
if ( ! $status ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ComparisonOperation::compare(
|
||||
$status,
|
||||
$rule->status,
|
||||
$rule->operation
|
||||
);
|
||||
}
|
||||
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\NoteStatusRuleProcessor';
|
||||
|
||||
/**
|
||||
* Validates the rule.
|
||||
* The version that this class was deprecated in.
|
||||
*
|
||||
* @param object $rule The rule to validate.
|
||||
*
|
||||
* @return bool Pass/fail.
|
||||
* @var string
|
||||
*/
|
||||
public function validate( $rule ) {
|
||||
if ( ! isset( $rule->note_name ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isset( $rule->status ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isset( $rule->operation ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
protected static $deprecated_in_version = '8.8.0';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user