Checks if a value is supported for this option.
Parameters
$valuemixedrequired- The value to check.
Source
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;
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.