public function ConditionGroup::__construct in Commerce Core 8.2
Constructs a new ConditionGroup object.
Parameters
\Drupal\commerce\Plugin\Commerce\Condition\ConditionInterface[] $conditions: The conditions.
string $operator: The operator. Possible values: AND, OR.
Throws
\InvalidArgumentException Thrown when an invalid operator is given.
File
- src/
ConditionGroup.php, line 41
Class
- ConditionGroup
- Represents a condition group.
Namespace
Drupal\commerceCode
public function __construct(array $conditions, string $operator) {
if (!in_array($operator, [
'AND',
'OR',
])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s" given, expecting "AND" or "OR".', $operator));
}
$this->conditions = $conditions;
$this->operator = $operator;
}