Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
20 | 834 | final class SkipOnEmptyNormalizer |
|
21 | 801 | { |
|
22 | /** |
||
23 | * Normalizes different types of "skip on empty" values including shortcuts to a callable: |
||
24 | 742 | * |
|
25 | 9 | * - `null` and `false` values are normalized to {@see NeverEmpty}. |
|
26 | * - `true` value is normalized to {@see WhenEmpty}. |
||
27 | * - A callable is left as is. |
||
28 | 739 | * - Other types are rejected causing the exception. |
|
29 | 738 | * |
|
30 | * @param mixed $skipOnEmpty Raw "skip on empty" value of any type. |
||
31 | * |
||
32 | 1 | * @throws InvalidArgumentException If the type of {@see $skipOnEmpty} is not valid. |
|
33 | * |
||
34 | * @return callable An empty condition as a callable. |
||
35 | */ |
||
36 | public static function normalize(mixed $skipOnEmpty): callable |
||
53 |