protected function areConditionsValid(Transaction $transaction, Rule $rule) { if ($transaction->isProcessed()) { return false; } $isValid = true; $firstCondition = true; foreach ($rule->getConditions() as $condition) { $conditionClass = $this->factory->getConditionClass($condition->getCondition()); $conditionIsValid = $conditionClass->checkCondition($transaction, $condition); if ($firstCondition) { $isValid = $conditionIsValid ? true : false; $firstCondition = false; } elseif ($condition->getConditionLink() == 'OR') { if ($isValid || $conditionIsValid) { $isValid = true; } else { $isValid = false; } } else { if ($isValid && $conditionIsValid) { $isValid = true; } else { $isValid = false; } } } return $isValid; }
protected function getConditions() { $return = array(); foreach ($this->factory->getAllConditions() as $alias => $condition) { $return[$alias] = $condition->getName(); } return $return; }