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 |
||
33 | 2 | private function normalizeRule($rule): Rule |
|
34 | { |
||
35 | 2 | if (is_callable($rule)) { |
|
36 | 1 | $rule = new Callback($rule); |
|
|
|||
37 | } |
||
38 | |||
39 | 2 | if (!$rule instanceof Rule) { |
|
40 | 1 | throw new \InvalidArgumentException( |
|
41 | 1 | 'Rule should be either instance of Rule class or a callable' |
|
42 | ); |
||
43 | } |
||
44 | |||
45 | 1 | return $rule; |
|
46 | } |
||
48 |