Transformers
1 year ago
BaseLocationCountryRuleProcessor.php
2 years ago
BaseLocationStateRuleProcessor.php
2 years ago
ComparisonOperation.php
2 years ago
ContextPluginsRuleProcessor.php
1 year ago
EvaluateAndGetStatus.php
2 years ago
EvaluateOverrides.php
1 year ago
EvaluationLogger.php
1 year ago
FailRuleProcessor.php
2 years ago
GetRuleProcessor.php
2 years ago
GetRuleProcessorForContext.php
1 year ago
IsEcommerceRuleProcessor.php
2 years ago
IsWooExpressRuleProcessor.php
2 years ago
NotRuleProcessor.php
2 years ago
NoteStatusRuleProcessor.php
2 years ago
OnboardingProfileRuleProcessor.php
2 years ago
OptionRuleProcessor.php
2 years ago
OrRuleProcessor.php
2 years ago
OrderCountRuleProcessor.php
2 years ago
OrdersProvider.php
2 years ago
PassRuleProcessor.php
2 years ago
PluginVersionRuleProcessor.php
2 years ago
PluginsActivatedRuleProcessor.php
2 years ago
ProductCountRuleProcessor.php
1 year ago
PublishAfterTimeRuleProcessor.php
2 years ago
PublishBeforeTimeRuleProcessor.php
2 years ago
RuleEvaluator.php
1 year ago
RuleProcessorInterface.php
2 years ago
StoredStateRuleProcessor.php
2 years ago
StoredStateSetupForProducts.php
2 years ago
TotalPaymentsVolumeProcessor.php
1 year ago
WCAdminActiveForProvider.php
2 years ago
WCAdminActiveForRuleProcessor.php
2 years ago
WooCommerceAdminUpdatedRuleProcessor.php
2 years ago
IsEcommerceRuleProcessor.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Rule processor that passes (or fails) when the site is on the eCommerce |
| 4 | * plan. |
| 5 | * |
| 6 | * @package WooCommerce\Admin\Classes |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors; |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | /** |
| 14 | * Rule processor that passes (or fails) when the site is on the eCommerce |
| 15 | * plan. |
| 16 | */ |
| 17 | class IsEcommerceRuleProcessor implements RuleProcessorInterface { |
| 18 | /** |
| 19 | * Passes (or fails) based on whether the site is on the eCommerce plan or |
| 20 | * not. |
| 21 | * |
| 22 | * @param object $rule The rule being processed by this rule processor. |
| 23 | * @param object $stored_state Stored state. |
| 24 | * |
| 25 | * @return bool The result of the operation. |
| 26 | */ |
| 27 | public function process( $rule, $stored_state ) { |
| 28 | if ( ! function_exists( 'wc_calypso_bridge_is_ecommerce_plan' ) ) { |
| 29 | return false === $rule->value; |
| 30 | } |
| 31 | |
| 32 | return (bool) wc_calypso_bridge_is_ecommerce_plan() === $rule->value; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Validate the rule. |
| 37 | * |
| 38 | * @param object $rule The rule to validate. |
| 39 | * |
| 40 | * @return bool Pass/fail. |
| 41 | */ |
| 42 | public function validate( $rule ) { |
| 43 | if ( ! isset( $rule->value ) ) { |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | return true; |
| 48 | } |
| 49 | } |
| 50 |