Set the allowed association types, checking to make sure each
combination is valid.

@access private
@param array $allowed_types
@return bool
13564
function setAllowedTypes($allowed_types)
    {
        foreach ($allowed_types as $pair) {
            list($assoc_type, $session_type) = $pair;
            if (!Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
                return false;
            }
        }

        $this->allowed_types = $allowed_types;
        return true;
    }
139753
public function setAllowedEvents(array $allowedEvents)
    {
        $this->allowedEvents = array_unique(array_merge($this->allowedEvents, $allowedEvents));

        return $this;
    }
990660
public function allow($type)
    {
        if (!is_array($type)) {
            $type = func_get_args();
        }
        $this->allowedTypes = implode(',', $type);

        return $this;
    }
1084137
def _validate_allowed(self, allowed_values, field, value):
        
        if isinstance(value, Iterable) and not isinstance(value, _str_type):
            unallowed = set(value) - set(allowed_values)
            if unallowed:
                self._error(field, errors.UNALLOWED_VALUES, list(unallowed))
        else:
            if value not in allowed_values:
                self._error(field, errors.UNALLOWED_VALUE, value)
23482
public function set_rules(array $rule_set = [])
    {
        foreach ($rule_set as $attribute_key => $rules) {
            $this->validation->addAttribute($attribute_key, $rules);
        }

        return $this;
    }
1201497
public function setPhoneType($phone_type)
    {
        $allowedValues = $this->getPhoneTypeAllowableValues();
        if (!is_null($phone_type) && !in_array($phone_type, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'phone_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['phone_type'] = $phone_type;

        return $this;
    }
759010
protected function setMethodNotAllowedDecoratorMiddleware(array $allowed) : void
    {
        $middleware = $this->getStrategy()->getMethodNotAllowedDecorator(
            new MethodNotAllowedException($allowed)
        );

        $this->prependMiddleware($middleware);
    }
1008564
protected function validateOptions()
    {
        if (!isset($this->options['allowedTypes'])) {
            throw new InvalidValidationOptionsException('The option "allowedTypes" was not specified.', 1327947194);
        } elseif (!is_array($this->options['allowedTypes']) || $this->options['allowedTypes'] === []) {
            throw new InvalidValidationOptionsException('The option "allowedTypes" must be an array with at least one item.', 1327947224);
        }
    }
437031
private function setAllowedCookies()
    {
        $allowed = (isset($_COOKIE["gdpr_cookie"]) ? explode(',', $_COOKIE["gdpr_cookie"]) : []);
        foreach ($this->scopeSettings["scopes"] as $scope) {
            if ($scope['required'] == 1) {
                $allowed[] = $scope['scope'];
            }
        }

        $this->allowedCookies = $allowed;
    }
1239201
public void setAllowedValues(java.util.Collection<String> allowedValues) {
        if (allowedValues == null) {
            this.allowedValues = null;
            return;
        }

        this.allowedValues = new com.amazonaws.internal.SdkInternalList<String>(allowedValues);
    }
354867
def initialize_association(type, association, opts={})
      raise 'Illegal or unimplemented association type.' unless [:belongs_to].include?(type.to_s.to_sym)
      send type, association, opts if reflect_on_association(association).nil?
    end
754107
public function type(Model $model, $data, array $allowed = array()) {
        return $this->_validate($model, $data, 'type', array($allowed));
    }
394627
def setAllowedTypes(self, allowed_types):
        """"""
        for (assoc_type, session_type) in allowed_types:
            checkSessionType(assoc_type, session_type)

        self.allowed_types = allowed_types
11745
public function isEvaluableForTypes(string ...$types): bool
    {
        if (!$this->isValid()) {
            return false;
        }

        if (is_empty($types)) {
            return true;
        }

        return Data::make($this->value)->isTypeOf(...$types);
    }
1030659
public static function setDataTypes(array $types) : void
    {
        // Datatypes key validation
        foreach ($types as $key => $value) {
            if (!preg_match('/^[A-Za-z0-9-_]+$/', $key)) {
                throw new \UnexpectedValueException("<b>$key</b> is not a valid datatype key", 1);

            } elseif (!is_string($value)) {
                throw new \LogicException("<b>$key</b> must have a string value", 1);
            }
        }

        // Put keys between brackets
        self::$datatypes = array_combine(
            array_map(function ($t) {
                return '/\{' . $t . '\}/';
            }, array_keys($types)),
            $types
        );
    }
765034
public function setPossibleTypes(array $possibleTypes)
    {
        foreach ($possibleTypes as $type) {
            $this->possibleTypes[] = ApiDefinition::determineType(\trim($type), ['type' => \trim($type)]);
        }

        return $this;
    }
1263543
function( value, allowed_values ) {
			var error;

			// Convert the allowed_values to an array:
			allowed_values = allowed_values.split( ',' );

			if ( allowed_values.indexOf( value ) === -1 ) {
				error = {
					"rule": "matches",
					"message": "ERROR:provided value does not match an allowed value: " + allowed_values
				};
				return [ error ];
			}
			return;
		}