Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | 3 | private function normalizeRule($rule): Rule |
|
40 | { |
||
41 | 3 | if (is_callable($rule)) { |
|
42 | 2 | $rule = new Callback($rule); |
|
|
|||
43 | } |
||
44 | |||
45 | 3 | if (!$rule instanceof Rule) { |
|
46 | 1 | throw new \InvalidArgumentException( |
|
47 | 1 | 'Rule should be either instance of Rule class or a callable' |
|
48 | ); |
||
49 | } |
||
50 | |||
51 | 2 | return $rule; |
|
52 | } |
||
54 |