[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Providers/Models/DTO/ -> SupportedOption.php (summary)

(no description)

File Size: 186 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SupportedOption:: (9 methods):
  __construct()
  getName()
  isSupportedValue()
  normalizeValue()
  normalizeArrayForComparison()
  getSupportedValues()
  getJsonSchema()
  toArray()
  fromArray()


Class: SupportedOption  - X-Ref

Represents a supported configuration option for an AI model.

This class defines an option that a model supports, including its name
and the values that are valid for that option.

__construct(OptionEnum $name, ?array $supportedValues = null)   X-Ref
Constructor.

param: OptionEnum $name The option name.
param: list<mixed>|null $supportedValues The supported values for this option, or null if any value is supported.

getName()   X-Ref
Gets the option name.

return: OptionEnum The option name.

isSupportedValue($value)   X-Ref
Checks if a value is supported for this option.

return: bool True if the value is supported, false otherwise.
param: mixed $value The value to check.

normalizeValue($value)   X-Ref
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.

return: mixed The normalized value.
param: mixed $value The value to normalize.

normalizeArrayForComparison(array $items)   X-Ref
Normalizes and sorts an array for comparison.

Maps each element through normalizeValue() and sorts the result,
ensuring consistent comparison regardless of element order or
AbstractEnum instance identity.

return: array<mixed> The normalized, sorted array.
param: array<mixed> $items The array to normalize.

getSupportedValues()   X-Ref
Gets the supported values for this option.

return: list<mixed>|null The supported values, or null if any value is supported.

getJsonSchema()   X-Ref
{@inheritDoc}


toArray()   X-Ref
{@inheritDoc}

return: SupportedOptionArrayShape

fromArray(array $array)   X-Ref
{@inheritDoc}




Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref