Validates the given reason-phrase

@param mixed $reasonPhrase

@return void

@throws \InvalidArgumentException

@link https://tools.ietf.org/html/rfc7230#section-3.1.2
540334
protected function validateReasonPhrase($reasonPhrase) : void
	{
		if (! \is_string($reasonPhrase))
		{
			throw new \InvalidArgumentException('HTTP reason-phrase must be a string');
		}
		else if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase))
		{
			throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase));
		}
	}
630528
protected function _setStatus($code, $reasonPhrase = '')
    {
        if (!isset($this->_statusCodes[$code])) {
            throw new InvalidArgumentException(sprintf(
                'Invalid status code: %s. Use a valid HTTP status code in range 1xx - 5xx.',
                $code
            ));
        }

        $this->_status = $code;
        if (empty($reasonPhrase)) {
            $reasonPhrase = $this->_statusCodes[$code];
        }
        $this->_reasonPhrase = $reasonPhrase;
        $this->_setContentType();
    }
342230
private function _filterScheme($scheme)
    {
        $scheme = strtolower($scheme);
        $scheme = preg_replace('#:(//)?$#', '', $scheme);

        if (!preg_match('/\A[a-z][a-z0-9\+\-\.]+\z/', $scheme)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid scheme "%s" specified; must be a valid RFC 3986 scheme',
                $scheme
            ));
        }

        if ($scheme && !in_array($scheme, $this->allowedSchemes)) {
            throw new InvalidArgumentException(sprintf(
                'Unsupported scheme "%s"; must be any empty string or in the set (%s)',
                $scheme,
                implode(', ', array_keys($this->allowedSchemes))
            ));
        }

        return $scheme;
    }
1288533
public function withStatus($code, $reasonPhrase = '')
    {
        $this->getStateObject()->setStatusCode($code);
        $this->getStateObject()->setReasonPhrase($reasonPhrase);

        return $this;
    }
1048545
protected function validateMethod($method) : void
	{
		if (! \is_string($method))
		{
			throw new \InvalidArgumentException('HTTP method must be a string');
		}
		else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method))
		{
			throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method));
		}
	}
873083
public function setStatus(int $code, string $reason = null): self
    {
        if (!isset(ResponseMessage::$phrases[$code])) {
            throw new \InvalidArgumentException("The HTTP status code is not valid: {$code}");
        }

        $this->status = $code;

        if ($reason === null) {
            $reason = ResponseMessage::$phrases[$code];
        }
        $this->reason = $reason;

        return $this;
    }
30699
protected function generateResponse(
        int $code,
        string $reasonPhrase = ""
    ): ResponseInterface{
        return $this->getResponseFactory()
            ->createResponse($code, $reasonPhrase)
        ;
    }
781411
protected function validateProtocolVersion($protocolVersion) : void
	{
		if (! \is_string($protocolVersion))
		{
			throw new \InvalidArgumentException('HTTP protocol version must be a string');
		}
		else if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion))
		{
			throw new \InvalidArgumentException(\sprintf('The given protocol version "%s" is not valid', $protocolVersion));
		}
	}
35756
@Override
    public void setReasonPhrase(String reason) {
        this.myReason = reason;
        this.myReasonBytes = GenericUtils.getEnglishBytes(reason);
        super.setFirstLineChanged();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "setReasonPhrase(String): set to [" + this.myReason + "]");
        }
    }
604460
private function validateState()
    {
        if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
            $this->host = self::DEFAULT_HTTP_HOST;
        }
        if ($this->getAuthority() === '') {
            if (0 === strpos($this->path, '//')) {
                throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
            }
            if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
                throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
            }
        } elseif (isset($this->path[0]) && $this->path[0] !== '/') {
            $this->path = '/' . $this->path;
        }
    }
473111
protected function validateHeaderValue($headerValue) : void
	{
		if (\is_string($headerValue))
		{
			$headerValue = [$headerValue];
		}

		if (! \is_array($headerValue) || [] === $headerValue)
		{
			throw new \InvalidArgumentException('Header value must be a string or not an empty array');
		}

		foreach ($headerValue as $oneOf)
		{
			if (! \is_string($oneOf))
			{
				throw new \InvalidArgumentException('Header value must be a string or an array containing only strings');
			}
			else if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $oneOf))
			{
				throw new \InvalidArgumentException(\sprintf('The given header value "%s" is not valid', $oneOf));
			}
		}
	}
489478
public void setStatus(int statusCode, String reasonPhrase) {
		try {
			final Response response = getResponse();
			response.setStatusCode(statusCode);
			response.setReasonPhrase(reasonPhrase);
		} catch (ParseException e) {
			throw new IllegalArgumentException(e);
		}

	}
87272
protected function setScheme($scheme)
    {
        $scheme = strtolower($scheme);
        
        if ($scheme !== '' && !$this->isSupportedScheme($scheme)) {
            throw new \InvalidArgumentException("Invalid or unsupported scheme '$scheme'");
        }
        
        $this->scheme = $scheme;
    }
670264
public static function validateLanguageCode(string $languageCode = null): string
    {
        // We allow empty languageCode in order to quit asking for more
        if (empty($languageCode)) {
            return '';
        }

        if (!preg_match('/^[a-z][a-z][a-z]-[A-Z][A-Z]$/', $languageCode)) {
            throw new InvalidArgumentException('Language code name is not valid.');
        }

        return $languageCode;
    }
1188419
protected function validateStatusCode($statusCode) : void
	{
		if (! \is_int($statusCode))
		{
			throw new \InvalidArgumentException('HTTP status-code must be an integer');
		}
		else if (! ($statusCode >= 100 && $statusCode <= 599))
		{
			throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode));
		}
	}
365749
protected function _setValidator($validator)
    {
        if (!is_null($validator) && !($validator instanceof ValidatorInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid validator'), null, null, $validator);
        }

        $this->validator = $validator;
    }
1034484
public function setErrorString($code, $message)
    {
        if (!$this->isTranslatableStringValueValid($message)) {
            throw new InvalidArgumentException('Invalid translatable string value provided for Validator');
        }

        $this->translatable_errors[$code] = $message;
    }