Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function __call($name, $arguments): static |
||
22 | { |
||
23 | $namespace = __NAMESPACE__ . '\\Rules'; |
||
24 | $class = sprintf("%s\%s", $namespace, ucfirst($name)); |
||
25 | if (!class_exists($class)) { |
||
26 | throw new RuntimeException(sprintf('Rule not found: (%s).', $name)); |
||
27 | } |
||
28 | |||
29 | $rule = new $class(...$arguments); |
||
30 | if ($rule instanceof Rule) { |
||
31 | $this->add($rule); |
||
32 | } |
||
33 | |||
34 | return $this; |
||
35 | } |
||
37 |