public static function getOptionsValidator(array $options) {
    return function ($value) use ($options) {
      if (!in_array($value, $options)) {
        $options_formatted = implode(', ', $options);
        $error_message = sprintf('The value should be one of the following: %s.', $options_formatted);
        throw new \UnexpectedValueException($error_message);
      }
      return $value;
    };
  }
public static function getOptionsValidator(array $options) {
    return function ($value) use ($options) {
      if (!in_array($value, $options)) {
        $options_formatted = implode(', ', $options);
        $error_message = sprintf('The value should be one of the following: %s.', $options_formatted);
        throw new \UnexpectedValueException($error_message);
      }
      return $value;
    };
  }
public static function getOptionsValidator ( array $ options ) { return function ( $ value ) use ( $ options ) { if ( ! in_array ( $ value , $ options ) ) { $ options_formatted = implode ( ', ' , $ options ) ; $ error_message = sprintf ( 'The value should be one of the following: %s.' , $ options_formatted ) ; throw new \ UnexpectedValueException ( $ error_message ) ; } return $ value ; } ; }
Returns a validator for allowed options.

@param array $options
Allowed values.

@return callable
Question validator.
Returns a validator for allowed options .