| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public static function normalize(mixed $skipOnEmpty): callable |
||
| 37 | { |
||
| 38 | if ($skipOnEmpty === false || $skipOnEmpty === null) { |
||
| 39 | return new NeverEmpty(); |
||
| 40 | } |
||
| 41 | |||
| 42 | if ($skipOnEmpty === true) { |
||
| 43 | return new WhenEmpty(); |
||
| 44 | } |
||
| 45 | |||
| 46 | if (is_callable($skipOnEmpty)) { |
||
| 47 | return $skipOnEmpty; |
||
| 48 | } |
||
| 49 | |||
| 50 | throw new InvalidArgumentException('$skipOnEmpty must be a null, a boolean or a callable.'); |
||
| 51 | } |
||
| 53 |