WordPress\AiClient\Providers\Models\DTO

SupportedOption::normalizeValueprivate staticWP 1.2.1

Normalizes an AbstractEnum instance to its string value.

This ensures comparisons work correctly even after deserialization (e.g. Redis/Memcached object cache), where AbstractEnum singletons are reconstructed as separate instances.

Method of the class: SupportedOption{}

No Hooks.

Returns

Mixed. The normalized value.

Usage

$result = SupportedOption::normalizeValue( $value );
$value(mixed) (required)
The value to normalize.

Changelog

Since 1.2.1 Introduced.

SupportedOption::normalizeValue() code WP 7.0.4

private static function normalizeValue($value)
{
    if ($value instanceof AbstractEnum) {
        return $value->value;
    }
    return $value;
}