/** * @param RuleInterface[] $result * @param RuleInterface $rule */ protected function findMatchesForContextRule(&$result, $rule) { $cond = $rule->getCondition(); $match = $cond === '' ? true : $this->evaluator->evaluate($rule->getCondition()); if (!is_bool($match)) { throw new \RuntimeException(sprintf('The condition result for rule %s (%s) should be boolean, not %s.', $rule->getId(), $rule->getName(), gettype($match))); } if ($match) { $result[] = $rule; } }