ContextPluginsRuleProcessor
in package
implements
RuleProcessorInterface
Rule processor for context_plugins rules.
Processes the following rule: { "type": "context_plugins", "name": "name of a property in the plugin object", "value": "value to match", "operation": "operation" }
Interfaces, Classes and Traits
- RuleProcessorInterface
- Rule processor interface
Table of Contents
- $plugins : array<string|int, mixed>
- The list of plugin objects.
- __construct() : mixed
- Constructor.
- process() : bool
- Performs a comparison operation against the option value.
- validate() : bool
- Validates the rule.
Properties
$plugins
The list of plugin objects.
private
array<string|int, mixed>
$plugins
Plugin object is unmodified object from https://woocommerce.com/wp-json/wccom/obw-free-extensions/4.0/extensions.json
Example: { "id": "WooCommerce Shipping", "description": "description", "is_visible": true, "is_built_by_wc": true, "key": "woocommerce-shipping", }
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $plugins) : mixed
Parameters
- $plugins : array<string|int, mixed>
-
a list of plugins.
Return values
mixed —process()
Performs a comparison operation against the option value.
public
process(object $rule, object $stored_state) : bool
Parameters
- $rule : object
-
The specific rule being processed by this rule processor.
- $stored_state : object
-
Stored state.
Return values
bool — The result of the operation.validate()
Validates the rule.
public
validate(object $rule) : bool
Parameters
- $rule : object
-
The rule to validate.