$rulesetIds * @param array $matchCriteria */ public function __construct( private \Spameri\ElasticQuery\Query\LeafQueryInterface $organic, private array $rulesetIds, private array $matchCriteria, ) { if ($rulesetIds === []) { throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException( 'RuleQuery requires at least one rulesetId.', ); } } public function key(): string { return 'rule_' . $this->organic->key() . '_' . \implode('-', $this->rulesetIds); } /** * @return array> */ public function toArray(): array { return [ 'rule' => [ 'organic' => $this->organic->toArray(), 'ruleset_ids' => $this->rulesetIds, 'match_criteria' => $this->matchCriteria, ], ]; } }