final class ConfigValueNormalizer (View source)

internal  
 

Canonicalizes primitive values consumed by internal configuration resolvers.

Methods

static string
scalarStringOr(mixed $value, string $default)

Converts scalar input to text without trimming or replacing an empty result.

string
static string
nonEmptyStringOr(mixed $value, string $default)

Returns trimmed scalar text or the fallback when the input is structured or blank.

string
static string|null
nullableString(mixed $value)

Returns trimmed scalar text while treating null, structured, and blank input as absent.

string|null
static int
intOr(mixed $value, int $default)

Converts integers, floats, and numeric strings to an integer or returns the fallback.

int
static int|null
nullableInt(mixed $value)

Converts integers, floats, and numeric strings to an integer while treating other input as absent.

int|null
static float
floatOr(mixed $value, float $default)

Converts integers, floats, and numeric strings to a float or returns the fallback.

float
static bool
boolOr(mixed $value, bool $default)

Parses scalar input with PHP's validated boolean syntax or returns the fallback.

bool
static array
assoc(mixed $value)

Retains string-keyed entries from an array and treats non-array input as an empty mapping.

array
static array
stringList(mixed $value)

Returns unique trimmed non-empty scalar strings in their first-seen order.

array

Details

scalarStringOr

static string scalarStringOr(mixed $value, string $default)

Converts scalar input to text without trimming or replacing an empty result.

Parameters

mixed $value
string $default

Return Value

string

nonEmptyStringOr

static string nonEmptyStringOr(mixed $value, string $default)

Returns trimmed scalar text or the fallback when the input is structured or blank.

Parameters

mixed $value
string $default

Return Value

string

nullableString

static string|null nullableString(mixed $value)

Returns trimmed scalar text while treating null, structured, and blank input as absent.

Parameters

mixed $value

Return Value

string|null

intOr

static int intOr(mixed $value, int $default)

Converts integers, floats, and numeric strings to an integer or returns the fallback.

Parameters

mixed $value
int $default

Return Value

int

nullableInt

static int|null nullableInt(mixed $value)

Converts integers, floats, and numeric strings to an integer while treating other input as absent.

Parameters

mixed $value

Return Value

int|null

floatOr

static float floatOr(mixed $value, float $default)

Converts integers, floats, and numeric strings to a float or returns the fallback.

Parameters

mixed $value
float $default

Return Value

float

boolOr

static bool boolOr(mixed $value, bool $default)

Parses scalar input with PHP's validated boolean syntax or returns the fallback.

Parameters

mixed $value
bool $default

Return Value

bool

assoc

static array assoc(mixed $value)

Retains string-keyed entries from an array and treats non-array input as an empty mapping.

Parameters

mixed $value

Return Value

array

stringList

static array stringList(mixed $value)

Returns unique trimmed non-empty scalar strings in their first-seen order.

Parameters

mixed $value

Return Value

array