Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | trait CommonFactory |
||
15 | { |
||
16 | abstract public function add(Rule|RuleSet ...$rules): static; |
||
17 | |||
18 | public function check(callable $rule, ?string $message = null): static |
||
19 | { |
||
20 | return $this->add(new Generic($rule, $message)); |
||
21 | } |
||
22 | |||
23 | public function allowsNull(): static |
||
24 | { |
||
25 | return $this->add(new AllowsNull); |
||
26 | } |
||
27 | |||
28 | public function allowsEmpty(): static |
||
29 | { |
||
30 | return $this->add(new AllowsEmpty); |
||
31 | } |
||
32 | |||
33 | public function notRequired(): static |
||
36 | } |
||
37 | |||
38 | public function notEmptyString(?string $message = null): static |
||
41 | } |
||
42 | } |
||
43 |