Static constructor to create from when a parameter should be one of a set of allowed values, but was not.

@param string $parameterName
@param mixed[] $allowedValues
@param mixed $actualValue
@return static
197918
public static function notValidParameter($parameterName, array $allowedValues, $actualValue)
    {
        return new static(
            sprintf(
                'Parameter: "%s" can only be one of: "%s" Received: "%s"',
                $parameterName,
                static::stringify($allowedValues),
                static::stringify($actualValue)
            )
        );
    }
406142
protected void addAllowedValuesToDescription(ModelNode result, ParameterValidator validator) {
        if (allowedValues != null) {
            for (ModelNode allowedValue : allowedValues) {
                result.get(ModelDescriptionConstants.ALLOWED).add(allowedValue);
            }
        } else if (validator instanceof AllowedValuesValidator) {
            AllowedValuesValidator avv = (AllowedValuesValidator) validator;
            List<ModelNode> allowed = avv.getAllowedValues();
            if (allowed != null) {
                for (ModelNode ok : allowed) {
                    result.get(ModelDescriptionConstants.ALLOWED).add(ok);
                }
            }
        }
    }
440805
public function getValue($params = [], $processCallbacks = true)
    {
        if ($this->isNull($this->value) && !$this->isNull($this->defaultValue)) {
            $this->value = $this->getDefaultValue();
        }

        return $this->processGetValue($this->value, $params, $processCallbacks);
    }
825421
private function getParameterConstraints(
        ParameterDefinition $parameterDefinition,
        ParameterStruct $parameterStruct,
        bool $validateEmptyValue = true
    ): array {
        $parameterValue = $parameterStruct->getParameterValue(
            $parameterDefinition->getName()
        );

        if (!$validateEmptyValue && $parameterValue === null) {
            return [];
        }

        return $parameterDefinition->getType()->getConstraints(
            $parameterDefinition,
            $parameterValue
        );
    }
806061
public function setAllowedSchemes($allowedSchemes)
    {
        if (empty($allowedSchemes)) {
            throw new \InvalidArgumentException("Allowed schemes cannot be empty.");
        }

        $allowedSchemes = (array) $allowedSchemes;
        $c = count($allowedSchemes);
        for ($i = 0; $i < $c; ++$i) {
            if (empty($allowedSchemes[$i])) {
                throw new \InvalidArgumentException("An allowed scheme cannot be empty.");
            } elseif (!preg_match(static::SCHEME_PATTERN, $allowedSchemes[$i])) {
                throw new \InvalidArgumentException("Allowed scheme [{$allowedSchemes[$i]}] contains illegal characters (see RFC3986).");
            }
        }
        $this->allowedSchemes = $allowedSchemes;

        return $this;
    }
671291
public static function createImageFromPostValues($postValues, $filename, $fileNames)
    {
        $imageObject = new \stdClass();
        $imageObject->file = $filename;
        $imageObject->type = $postValues['type'];
        $imageObject->size = $postValues['size'];
        $imageObject->set = $fileNames;

        return new Image($imageObject);
    }
1157150
final public static function box($plainValue): self
    {
        foreach (static::valueNames() as $name) {
            if (self::constant($name) === $plainValue) {
                return self::__callStatic($name, []);
            }
        }

        $message = sprintf('Value %s is not within %s enumeration.', $plainValue, static::class);
        throw new InvalidArgumentException($message);
    }
930511
protected function checkValueStructure(BaseValue $value)
    {
        if (!is_float($value->latitude) && !is_int($value->latitude)) {
            throw new InvalidArgumentType(
                '$value->latitude',
                'float',
                $value->latitude
            );
        }
        if (!is_float($value->longitude) && !is_int($value->longitude)) {
            throw new InvalidArgumentType(
                '$value->longitude',
                'float',
                $value->longitude
            );
        }
        if (!is_string($value->address)) {
            throw new InvalidArgumentType(
                '$value->address',
                'string',
                $value->address
            );
        }
    }
517267
public function setValues(array $values, $allowedPrefixes = null)
    {
        $isStartsWith = $this->isStartsWith;
        foreach ($values as $id => $value) {
            if ($allowedPrefixes && !$isStartsWith($id, $allowedPrefixes)) {
                continue;
            }
            $this->setValue($id, $value);
        }

        return $this;
    }
225163
protected function checkValues($value, array $allowed)
    {
        if (!in_array($value, $allowed)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid arg `%s`, use one of these: %s',
                $value,
                implode(', ', $allowed)
            ));
        }
    }
315267
protected function throwIfPointNotValid($point, $pointName, array $allowedStringValues)
    {
        if (is_string($point) && in_array($point, $allowedStringValues)) {
            return;
        }

        if (is_integer($point) && $point >= 0) {
            return;
        }

        throw new \InvalidArgumentException(sprintf(
            'Expected "%s" one of the [%s] or integer greater than zero',
            $pointName,
            implode('|', $allowedStringValues)
        ));
    }
912108
final public static function allowedParams (array $allowedParams=[], string $option) : array
	{
		$allowedArray 	= [];
		$option 		= static::checkGlobal($option);
		foreach ($allowedParams as $param) $allowedArray[$param] = $option[$param] ?? NULL;
		return $allowedArray;
	}
681884
protected function checkValueStructure(BaseValue $value)
    {
        if (isset($value->inputUri) && !is_string($value->inputUri)) {
            throw new InvalidArgumentType('$value->inputUri', 'string', $value->inputUri);
        }

        if (isset($value->id) && !is_string($value->id)) {
            throw new InvalidArgumentType('$value->id', 'string', $value->id);
        }

        // Required parameter $fileName
        if (!isset($value->fileName) || !is_string($value->fileName)) {
            throw new InvalidArgumentType('$value->fileName', 'string', $value->fileName);
        }

        // Optional parameter $alternativeText
        if (isset($value->alternativeText) && !is_string($value->alternativeText)) {
            throw new InvalidArgumentType(
                '$value->alternativeText',
                'string',
                $value->alternativeText
            );
        }

        if (isset($value->fileSize) && (!is_int($value->fileSize) || $value->fileSize < 0)) {
            throw new InvalidArgumentType(
                '$value->fileSize',
                'int',
                $value->alternativeText
            );
        }
    }
249905
public function bindComponent($instanceName, $paramName, $paramValue) {
		if ($paramValue == null) {
			unset($this->declaredInstances[$instanceName]["fieldBinds"][$paramName]);
		} else {
			$this->declaredInstances[$instanceName]["fieldBinds"][$paramName] = $paramValue;
		}
	}
117278
public static function buildPHPINIValue($name, $expectedValue, $optional = false)
    {
        $returnValue = null;

        
        $returnValue = new common_configuration_PHPINIValue($expectedValue, $name, $optional);
        

        return $returnValue;
    }
559586
public function normalizeValue(Parameter $parameter, string $value = null)
    {
        if (\is_bool($default = $parameter->default())) {
            return !$default;
        }

        if ($parameter->variadic()) {
            return (array) $value;
        }

        if (null === $value) {
            return $parameter->required() ? null : true;
        }

        return $parameter->filter($value);
    }
518178
public function addIndexedParameter($parameterName, $parameterValue, $parameterIndex)
    {
        $this->getParameter()->addItem(new PagSeguroParameterItem($parameterName, $parameterValue, $parameterIndex));
    }