Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
18 | 838 | public static function normalize(mixed $skipOnEmpty): callable |
|
19 | { |
||
20 | 838 | if ($skipOnEmpty === false || $skipOnEmpty === null) { |
|
21 | 805 | return new NoEmpty(); |
|
22 | } |
||
23 | |||
24 | 746 | if ($skipOnEmpty === true) { |
|
25 | 9 | return new SimpleEmpty(); |
|
26 | } |
||
27 | |||
28 | 743 | if (is_callable($skipOnEmpty)) { |
|
29 | 742 | return $skipOnEmpty; |
|
30 | } |
||
31 | |||
32 | 1 | throw new InvalidArgumentException('$skipOnEmpty must be a null, a boolean or a callable.'); |
|
33 | } |
||
35 |