Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 2 | private function normalizeRule($rule): Rule |
|
31 | { |
||
32 | 2 | if (is_callable($rule)) { |
|
33 | 1 | $rule = new Callback($rule); |
|
|
|||
34 | } |
||
35 | |||
36 | 2 | if (!$rule instanceof Rule) { |
|
37 | 1 | throw new \InvalidArgumentException( |
|
38 | 1 | 'Rule should be either instance of Rule class or a callable' |
|
39 | ); |
||
40 | } |
||
41 | |||
42 | 1 | return $rule; |
|
43 | } |
||
45 |