| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 3 | public static function normalize(mixed $skipOnEmpty): ?callable |
|
| 18 | { |
||
| 19 | 3 | if ($skipOnEmpty === false) { |
|
| 20 | 1 | return null; |
|
| 21 | } |
||
| 22 | |||
| 23 | 2 | if ($skipOnEmpty === true) { |
|
| 24 | 1 | return new SkipOnEmpty(); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | if (!is_callable($skipOnEmpty)) { |
|
| 28 | throw new InvalidArgumentException('$skipOnEmpty must be a boolean or a callable.'); |
||
| 29 | } |
||
| 30 | |||
| 31 | 1 | return $skipOnEmpty; |
|
| 32 | } |
||
| 34 |