WordPress\AiClient\Providers\Models\DTO
SupportedOption::isSupportedValue
Checks if a value is supported for this option.
Метод класса: SupportedOption{}
Хуков нет.
Возвращает
bool. True if the value is supported, false otherwise.
Использование
$SupportedOption = new SupportedOption(); $SupportedOption->isSupportedValue( $value ): bool;
- $value(разное) (обязательный)
- The value to check.
Список изменений
| С версии 0.1.0 | Введена. |
Код SupportedOption::isSupportedValue() SupportedOption::isSupportedValue WP 7.1.4
public function isSupportedValue($value): bool
{
// If supportedValues is null, any value is supported
if ($this->supportedValues === null) {
return \true;
}
// If the value is an array, consider it a set (i.e. order doesn't matter).
if (is_array($value)) {
$normalizedValue = self::normalizeArrayForComparison($value);
foreach ($this->supportedValues as $supportedValue) {
if (!is_array($supportedValue)) {
continue;
}
$normalizedSupported = self::normalizeArrayForComparison($supportedValue);
if ($normalizedValue === $normalizedSupported) {
return \true;
}
}
return \false;
}
$normalizedValue = self::normalizeValue($value);
foreach ($this->supportedValues as $supportedValue) {
if (self::normalizeValue($supportedValue) === $normalizedValue) {
return \true;
}
}
return \false;
}