@param $value

@return $this
@throws InvalidRequestException
545182
public function setEnvironment($value)
    {
        $env = strtolower($value);

        if (! isset($this->endpoints[$env])) {
            throw new InvalidRequestException('The environment is invalid');
        }

        $this->setEndpoint($this->endpoints[$env]);

        return $this;
    }
82322
public function setSex($value)
    {
        if ($value !== self::SEX_MALE &&
           $value !== self::SEX_FEMALE &&
           $value !== self::SEX_OTHERS) {
            throw new DomainError("Invalid sex");
        }
        $this->parameters['sex'] = $value;
        return $this;
    }
1077635
protected function setValue($value)
    {
        if (!is_int($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be an integer", static::prototype());
        }
        $this->value = $value;
    }
790585
public function setPage($value)
    {
        if ($value === null || $value === '') {
            $this->_page = null;
        } elseif (TypeCast::canCastToString($value)) {
            $this->_page = (string)$value;
        } else {
            throw new InvalidPropertyValueTypeException(
                'Invalid status value in PaymentsRequest', 0, 'PaymentsRequest.page', $value
            );
        }
    }
306962
public function setValue($value)
    {
        if (is_numeric($value)) {
            $value = (string) $value;
        }

        if (!is_string($value) && $value !== null) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value))));
        }

        $this->node->nodeValue = $value;

        return $this;
    }
447018
public function setValue($value = null)
    {
        if (is_callable($value)) {
            $value = call_user_func($value);
        }

        $value = $this->handleJsonType($value);

        $this->value = $value;

        return $this;
    }
718219
public function setReceipt($value)
    {
        if (is_array($value)) {
            $this->receipt->fromArray($value);
        } elseif ($value instanceof ReceiptInterface) {
            $this->receipt = clone $value;
        } else {
            throw new InvalidPropertyValueTypeException('Invalid receipt value type', 0, 'receipt', $value);
        }

        return $this;
    }
826410
public function setCallbackUrl($value)
    {
        $this->callbackUrl = filter_var($value, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);

        if (!$this->callbackUrl) {
            throw new \Exception('Invalid URL.');
        }

        return $this;
    }
74893
public function setValue($value)
    {
        if (is_array($value)) {
            foreach ($value as $childKey => $childValue) {
                $this->children[$childKey] = new static($childValue);
            }
            $this->value = null;
        } else {
            $this->value = $value;
            $this->children = array();
        }
        return $this;
    }
635720
public function set($key, $value)
    {
        if (!\is_array($this->_data)) {
            throw new InvalidException('Document data is serialized data. Data creation is forbidden.');
        }
        $this->_data[$key] = $value;

        return $this;
    }
670632
public function setAsFloat($value)
    {
        if (!(is_numeric($value) || $value instanceof NumericTypeInterface)) {
            throw new \InvalidArgumentException('value is not numeric');
        }
        $val = is_object($value) ? $value->asFloatType()->get() : floatval($value);
        $intVal = pow(10, $this->precision->get()) * $val;
        parent::set($intVal);

        return $this;
    }
733246
protected function setValue($value)
    {
        if (!is_float($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a float", static::prototype());
        }

        $this->value = $value;
    }
1225564
public function setPaymentMethodData($value)
    {
        if ($value === null || $value === '') {
            $this->_paymentMethodData = null;
        } elseif (is_object($value) && $value instanceof AbstractPaymentData) {
            $this->_paymentMethodData = $value;
        } else {
            throw new InvalidPropertyValueTypeException(
                'Invalid paymentMethodData value type in CreatePaymentRequest',
                0,
                'CreatePaymentRequest.paymentMethodData',
                $value
            );
        }
    }
295695
public function marshal($value)
    {
        if ($this->options()->allowed && !in_array($value, $this->options()->allowed)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Allowed values for this field are %s.',
                    implode(', ', $this->options()->allowed)
                )
            );
        }
        return new TypedValue((string) $value);
    }
337331
public function setCustomValue(string $key, $value): Payload
    {
        if ($key === self::PAYLOAD_ROOT_KEY) {
            throw InvalidPayloadException::reservedKey();
        }

        $this->customValues[$key] = $value;

        return $this;
    }
1321748
public function min($value)
    {
        $v = $this->type('numeric')->value();

        if (is_null($v)) {
            return $this;
        }

        if ($v < $value) {
            throw new \Intervention\Image\Exception\InvalidArgumentException(
                sprintf('Argument %d must be at least %s.', $this->key, $value)
            );
        }

        return $this;
    }
586931
protected function setValue($value)
    {
        if (!isset($this->value) || null === $this->value) {
            $this->value = $value;
        }

        return $this;
    }