Commit a404e00b by Qiang Xue

simplified rule execution [skip ci]

parent face5262
...@@ -151,15 +151,11 @@ abstract class Manager extends Component ...@@ -151,15 +151,11 @@ abstract class Manager extends Component
*/ */
public function executeRule($ruleName, $params, $data) public function executeRule($ruleName, $params, $data)
{ {
if ($ruleName !== null) { $rule = $this->getRule($ruleName);
$rule = $this->getRule($ruleName); if ($rule instanceof Rule) {
if ($rule instanceof Rule) { return $rule->execute($params, $data);
return $rule->execute($params, $data);
} else {
throw new InvalidConfigException("Rule not found: $ruleName");
}
} else { } else {
return true; throw new InvalidConfigException("Rule not found: $ruleName");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment