ConfigValueNormalizer
final class ConfigValueNormalizer (View source)
| internal |
Canonicalizes primitive values consumed by internal configuration resolvers.
Methods
Converts scalar input to text without trimming or replacing an empty result.
Returns trimmed scalar text or the fallback when the input is structured or blank.
Returns trimmed scalar text while treating null, structured, and blank input as absent.
Converts integers, floats, and numeric strings to an integer or returns the fallback.
Converts integers, floats, and numeric strings to an integer while treating other input as absent.
Converts integers, floats, and numeric strings to a float or returns the fallback.
Parses scalar input with PHP's validated boolean syntax or returns the fallback.
Retains string-keyed entries from an array and treats non-array input as an empty mapping.
Returns unique trimmed non-empty scalar strings in their first-seen order.
Details
scalarStringOr
static string
scalarStringOr(mixed $value, string $default)
Converts scalar input to text without trimming or replacing an empty result.
nonEmptyStringOr
static string
nonEmptyStringOr(mixed $value, string $default)
Returns trimmed scalar text or the fallback when the input is structured or blank.
nullableString
static string|null
nullableString(mixed $value)
Returns trimmed scalar text while treating null, structured, and blank input as absent.
intOr
static int
intOr(mixed $value, int $default)
Converts integers, floats, and numeric strings to an integer or returns the fallback.
nullableInt
static int|null
nullableInt(mixed $value)
Converts integers, floats, and numeric strings to an integer while treating other input as absent.
floatOr
static float
floatOr(mixed $value, float $default)
Converts integers, floats, and numeric strings to a float or returns the fallback.
boolOr
static bool
boolOr(mixed $value, bool $default)
Parses scalar input with PHP's validated boolean syntax or returns the fallback.
assoc
static array
assoc(mixed $value)
Retains string-keyed entries from an array and treats non-array input as an empty mapping.
stringList
static array
stringList(mixed $value)
Returns unique trimmed non-empty scalar strings in their first-seen order.