Option name => `fn( $value ): bool`. */ private static function all(): array { // A day count: whole, not negative, and inside the range the field // declares. `is_numeric` first, because a constant is as likely to hold // "30" as 30 and both are perfectly good answers. $days = static function ( $value ): bool { return is_numeric( $value ) && (int) $value >= 0 && (int) $value <= 3650; }; return [ // The vocabulary check lives on the enum that owns the vocabulary; // this only points at it. 'albert_privacy_mode' => static function ( $value ): bool { return is_scalar( $value ) && PrivacyMode::try_parse( (string) $value ) !== null; }, // Safe mode is a plain on/off switch; anything else falls through to // the default rather than pinning the site to a nonsense value. // Booleans included: `define( 'ALBERT_SAFE_MODE', false )` is what a // PHP developer writes, and rejecting it silently left safe mode on // with the field still editable and no sign the constant was ignored. Gate::OPTION => static function ( $value ): bool { return Gate::is_valid( $value ); }, // A window outside the allowed range is not usable, so an override // naming one falls through rather than pinning the site to it. Interceptor::TTL_OPTION => static function ( $value ): bool { return is_numeric( $value ) && (int) $value >= Interceptor::MIN_TTL_MINUTES && (int) $value <= Interceptor::MAX_TTL_MINUTES; }, AllowedUsers::EXPIRY_OPTION => $days, ConnectionRetention::NEVER_USED_OPTION => $days, ConnectionRetention::IDLE_OPTION => $days, UploadLinkService::MAX_BYTES_OPTION => static function ( $value ): bool { return is_numeric( $value ) && (int) $value >= 1 && (int) $value <= UploadLinkService::MAX_SETTABLE_MB; }, ]; } }