Sets the status code and reason phrase. If no reason phrase is provided
the standard message according to the status code is used

@param integer $code
@param integer $reasonPhrase
324265
public function setStatus($code, $reasonPhrase = null)
    {
        $this->code = (int) $code;

        if ($reasonPhrase !== null) {
            $this->reasonPhrase = $reasonPhrase;
        } elseif (isset(Http::$codes[$this->code])) {
            $this->reasonPhrase = Http::$codes[$this->code];
        }
    }
579353
protected function setErrorDetails(string $reason, int $code)
    {
        $this->setError(ArrayContainer::make([
                'code'    => $code,
                'message' => $reason,
        ]));
    }
1288533
public function withStatus($code, $reasonPhrase = '')
    {
        $this->getStateObject()->setStatusCode($code);
        $this->getStateObject()->setReasonPhrase($reasonPhrase);

        return $this;
    }
1335684
function status($code) {
		$reason=@constant('self::HTTP_'.$code);
		if (PHP_SAPI!='cli')
			header($_SERVER['SERVER_PROTOCOL'].' '.$code.' '.$reason);
		return $reason;
	}
596043
public function setCode(int $code, string $reasonPhrase = null): self
    {
        $this->code         = $code;
        $this->reasonPhrase = null === $reasonPhrase ? Http::reasonPhraseFor($code) : $reasonPhrase;
        return $this;
    }
182254
public function setStatusCode($code)
    {
        static $sg = null;

        if (is_null($sg)) {
            $sg = new StatusGenerator();
        }

        $status = $sg->generate($code);

        if ($status !== false) {
            $this->append($status);
        }

        return $this;
    }
921414
public function withStatus($code, $reasonPhrase = '')
    {
        if (!is_string($reasonPhrase) && !method_exists($reasonPhrase, '__toString')) {
            throw new InvalidArgumentException('ReasonPhrase must be a string');
        }

        $clone = clone $this;
        $clone->statusCode = $code;
        if ($reasonPhrase === '' && isset(Header::$messages[$code])) {
            $reasonPhrase = Header::$messages[$code];
        }

        $clone->reasonPhrase = $reasonPhrase;

        return $clone;
    }
1211946
protected function getStatusHeader($protocolVersion, $statusCode, $reasonPhrase)
    {
        if (empty($reasonPhrase)) {
            $reasonPhrase = (new ResponseStatus($statusCode))->getReasonPhrase();
        }
        
        return "HTTP/{$protocolVersion} {$statusCode} {$reasonPhrase}";
    }
417732
protected function setExceptionDetails(string $reason, int $code, array $stack = [])
    {
        $this->setErrorDetails($reason, $code);

        $this->setDebugDetails($stack);
    }
1145117
public static function getStatusMessage($code) {
		if (!$code) {
			return '';
		}

		return isset(self::$statusMessages[$code]) ? self::$statusMessages[$code] : '';
	}
922851
protected function setStatus($code, $reasonPhrase)
    {
        $this->assertHeadersNotSent();

        parent::setStatus($code, $reasonPhrase);
        
        $this->sendStatusHeader();
    }
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));
		}
	}
352666
public function setStatusCode($code)
    {
        if (!is_int($code) || ($code < 100) || ($code > 599)) {
            throw new \BedRest\Rest\Exception("Invalid HTTP response code.");
        }

        $this->statusCode = $code;
    }
175969
public function setStatusCode($code)
	{
		if (!array_key_exists($code, self::$statusCodeMap)) {
			throw new InvalidArgumentException(sprintf('The HTTP stauts code %s is unknown.', $code));
		}

		$this->statusCode = $code;

		return $this;
	}
1027745
public function withStatus($code, $reasonPhrase = '')
    {
        $status = clone $this;
        $status->setStatus($code, $reasonPhrase);
        
        return $status;
    }
1184623
public function setStatus($code, $reasonPhrase = '')
    {
        $codeGroup = ResponseCode::getGroupFromCode($code);

        if ($codeGroup !== ResponseCode::GROUP_CLIENT_ERROR && $codeGroup !== ResponseCode::GROUP_SERVER_ERROR) {
            throw new \LogicException(__CLASS__ . ' accepts error codes only (4xx & 5xx).');
        }

        parent::setStatus($code, $reasonPhrase);
    }
1350903
protected function setResponseStatus(int $code, string $reasonPhrase = '') : void
    {
        $this->response = $this->response->withStatus($code, $reasonPhrase);
    }