@param int $httpStatusCode

@return $this
@throws ApiException
969673
public function setHttpStatusCode(int $httpStatusCode): self
    {
        if (!array_key_exists($httpStatusCode, Response::$statusTexts)) {
            $this->internalServerError('Invalid status code in ' . __METHOD__, Response::$statusTexts);
        }
        $this->httpStatusCode = $httpStatusCode;
        return $this;
    }
1198370
protected function processCurlResponse(int $statusCode, $curlHandle)
    {
        foreach ($this->runningRequests as $index => $request) {
            if ($request->getCurl()->getHandle() === $curlHandle) {
                $this->parseResponse($request, $statusCode)
                     ->triggerCallback($request->getOnCompleteCallback(), $request);

                $this->multiCurl->removeCurl($request->getCurl());
                unset($this->runningRequests[$index]);
                break;
            }
        }
        return $this;
    }
114984
protected function determineHttpStatusCode($httpStatusCode) {
		// add the new code
		$category = substr($httpStatusCode, 0, 1);
		$this->httpStatusCodes[$category][$httpStatusCode] = true;
		
		$advisedStatusCode = $httpStatusCode;
		
		// when there's multiple, give preference to 5xx errors
		if (isset($this->httpStatusCodes['5']) && isset($this->httpStatusCodes['4'])) {
			// use a generic one
			$advisedStatusCode = 500;
		}
		elseif (isset($this->httpStatusCodes['5'])) {
			if (count($this->httpStatusCodes['5']) === 1) {
				$advisedStatusCode = key($this->httpStatusCodes['5']);
			}
			else {
				// use a generic one
				$advisedStatusCode = 500;
			}
		}
		elseif (isset($this->httpStatusCodes['4'])) {
			if (count($this->httpStatusCodes['4']) === 1) {
				$advisedStatusCode = key($this->httpStatusCodes['4']);
			}
			else {
				// use a generic one
				$advisedStatusCode = 400;
			}
		}
		
		return (int) $advisedStatusCode;
	}
595748
public static function httpToVendor($httpCode = HttpCode::HTTP_OK): int
    {
        if ($httpCode < 400) {
            return Code::OK;
        }

        switch ($httpCode) {
            case HttpCode::HTTP_CLIENT_CLOSED_REQUEST:
                return Code::CANCELLED;

            case HttpCode::HTTP_INTERNAL_SERVER_ERROR:
                return Code::INTERNAL;

            case HttpCode::HTTP_GATEWAY_TIMEOUT:
                return Code::DEADLINE_EXCEEDED;

            case HttpCode::HTTP_NOT_FOUND:
                return Code::NOT_FOUND;

            case HttpCode::HTTP_CONFLICT:
                return Code::ALREADY_EXISTS;

            case HttpCode::HTTP_FORBIDDEN:
                return Code::PERMISSION_DENIED;

            case HttpCode::HTTP_UNAUTHORIZED:
                return Code::UNAUTHENTICATED;

            case HttpCode::HTTP_TOO_MANY_REQUESTS:
                return Code::RESOURCE_EXHAUSTED;

            case HttpCode::HTTP_PRECONDITION_FAILED:
                return Code::FAILED_PRECONDITION;

            case HttpCode::HTTP_NOT_IMPLEMENTED:
                return Code::UNIMPLEMENTED;

            case HttpCode::HTTP_SERVICE_UNAVAILABLE:
                return Code::UNAVAILABLE;

            default:
                if ($httpCode >= 500) {
                    return Code::INTERNAL;
                }

                if ($httpCode >= 400) {
                    return Code::INVALID_ARGUMENT;
                }

                return Code::OK;
        }
    }
913314
public function setStatus(int $code, string $status)
    {
        return $this
            ->set('code', $code)
            ->setHeader('Status', $status);
    }
268412
public function withStatusCode(int $code)
    {
        if ($this->statusCode == $code) {
            return $this;
        }

        $that = clone($this);
        $that->statusCode = $code;
        return $that;
    }
859686
public function setStatusCode($statusCode)
    {
        $statusCode = (int)$statusCode;
        if ($statusCode < 100 || $statusCode >= 600) {
            throw new \Exception("Invalid status code: {$statusCode}.");
        }
        $this->statusCode = $statusCode;
        return $this;
    }
485373
function success(int $code, string $body=''): \Nofuzz\Http\HTTPResponse
  {
    $this->setStatusCode($code);
    $this->setBody($body);

    return $this;
  }
833394
public function getStatusCode()
    {
        if (method_exists($this->exception, 'getStatusCode')) {
            $httpCode = $this->exception->getStatusCode();
        } else {
            $httpCode = config($this->configFile.'.http_code');
        }

        return $httpCode;
    }
751358
public function setStatusCode($code, $text = null)
    {
        $this->statusCode = (int)$code;

        if ($text) {
            $this->statusText = $text;
        } elseif (isset($this->statusTexts[$code])) {
            $this->statusText = $this->statusTexts[$code];
        }

        return $this;
    }
286453
public function putStatus(string $code, Status $status = null, string $explanation = null): Assert
    {
        return $this->put($code, null, $status, $explanation);
    }
367738
public function httpStatus(Int $code = NULL) : Restful
    {
        $code = $code ?? Redirect::status();

        header('HTTP/1.1 ' . $code . ' ' . Http::code($code));

        return $this;
    }
968572
public function hasStatusCode($statusCode)
    {
        try {
            $statusCode = $this->filterStatusCode($statusCode);
        } catch (InvalidArgumentException $e) {
            return false;
        }

        return isset($this->httpStatus[$statusCode]);
    }
410860
public static function isSuccessful(int $statusCode): bool
    {
        return ($statusCode >= HttpStatus::SUCCESSFUL) && ($statusCode < HttpStatus::REDIRECTION);
    }
600634
public function status($code)
    {
        if (in_array((int) $code, array_keys(self::$header), true)) {
            $this->code = $code;

            @header('HTTP/1.1 '. $code .' '. self::$header[$code], $this->override, $code);
        }

        return $this;
    }
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;
	}
932644
public function status( $code = null ) 
	{
		if ( !is_null( $code ) ) 
		{
			if ( headers_sent() && !CLI ) 
			{
				throw new CCException( "CCResponse::status - cannot change status header has already been send." );
			}

			$this->_status = $code; return $this;
		}

		return $this->_status;
	}