auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -7,63 +7,25 @@ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\DeprecatedClassFacade;
/**
* Rule processor for publishing based on the number of orders.
*
* @deprecated 8.8.0
*/
class OrderCountRuleProcessor implements RuleProcessorInterface {
class OrderCountRuleProcessor 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\OrderCountRuleProcessor';
/**
* The orders provider.
* The version that this class was deprecated in.
*
* @var OrdersProvider
* @var string
*/
protected $orders_provider;
/**
* Constructor.
*
* @param object $orders_provider The orders provider.
*/
public function __construct( $orders_provider = null ) {
$this->orders_provider = null === $orders_provider
? new OrdersProvider()
: $orders_provider;
}
/**
* Process the rule.
*
* @param object $rule The rule to process.
* @param object $stored_state Stored state.
*
* @return bool Whether the rule passes or not.
*/
public function process( $rule, $stored_state ) {
$count = $this->orders_provider->get_order_count();
return ComparisonOperation::compare(
$count,
$rule->value,
$rule->operation
);
}
/**
* Validates the rule.
*
* @param object $rule The rule to validate.
*
* @return bool Pass/fail.
*/
public function validate( $rule ) {
if ( ! isset( $rule->value ) ) {
return false;
}
if ( ! isset( $rule->operation ) ) {
return false;
}
return true;
}
protected static $deprecated_in_version = '8.8.0';
}