This will check that the configuration option matches one of the given values. The match will use
strict comparison. An exception will be thrown if it does not match.
The option can be mandatory or optional. If no default value is given, it will be considered to be
mandatory, and an exception will be thrown if it isn't provided. If a default value is given, it
is considered to be optional, and the default value is returned. The default value is automatically
included in the list of allowed values.
public getValueValidate ( string $name, array $allowedValues, mixed $default = self::REQUIRED_OPTION ) : mixed | ||
$name | string | The name of the option. |
$allowedValues | array | The values the option is allowed to take, as an array. |
$default | mixed | The default value which will be returned if the option isn't found. If this parameter isn't given, the option will be considered to be mandatory. The default value can be any value, including null. |
return | mixed | The option with the given name, or $default if the option isn't found and $default is given. |