| Total Complexity | 6 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class SpecialValue |
||
| 11 | { |
||
| 12 | private static self $empty; |
||
| 13 | |||
| 14 | public static function init(): void |
||
| 15 | { |
||
| 16 | self::$empty = new self(); |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * An empty value that is used to indicate that a value has not been set. |
||
| 21 | */ |
||
| 22 | public static function notSet(): self |
||
| 23 | { |
||
| 24 | return self::$empty; |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function isNotSet(mixed $value): bool |
||
| 28 | { |
||
| 29 | return $value === self::$empty; |
||
| 30 | } |
||
| 31 | |||
| 32 | public static function isEmpty(mixed $value): bool |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | SpecialValue::init(); |
||
| 39 |