Validates the given HTTP status code and returns an integer if correct.

@param mixed $code code to validate

@throws \InvalidArgumentException

@return int
763572
private function filterStatus($code): int
    {
        if (!is_numeric($code)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Status code "%s" is not numeric.',
                    is_scalar($code) ? $code : gettype($code)
                )
            );
        }

        $result = (int) $code;
        if (!self::isValid($result)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Invalid status code "%s".',
                    $result
                )
            );
        }

        return $result;
    }
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));
		}
	}
328308
public function setHttpStatusCode($code)
    {
        $code = intval($code);
        if (!is_int($code)
            || $code < 100
            || $code > 599
        ) {
            trigger_error('Invalid HTTP status code, not taken into account.', E_USER_WARNING);
            return false;
        }
        $this->httpStatusCode = $code;
        return true;
    }
1011071
public function setHttpStatusCode($httpStatusCode) {
		if (Validator::checkHttpStatusCode($httpStatusCode) === false) {
			throw new InputException('can not use an invalid http status code');
		}
		
		$this->httpStatusCode = $httpStatusCode;
	}
1351575
public function getName(string $code): string
    {
        $result = $code;

        if (empty($code)) {
            throw new InvalidArgumentException("Code must be a non-empty string.");
        }

        $languages = $this->getSupported();
        if (!empty($languages[$code])) {
            $result = $languages[$code];
        }

        return $result;
    }
140813
public function seeResponseCodeIs($code)
    {
        $failureMessage = sprintf(
            'Expected HTTP Status Code: %s. Actual Status Code: %s',
            HttpCode::getDescription($code),
            HttpCode::getDescription($this->getResponseStatusCode())
        );
        $this->assertEquals($code, $this->getResponseStatusCode(), $failureMessage);
    }
1088889
public function validate($code)
    {
        $correctCode = $this->storage->pull();

        if (! empty($correctCode)) {
            return mb_strtolower($correctCode) === mb_strtolower($code);
        }

        return false;
    }
154088
public function setStatusCode($code)
    {
        $code = (int) $code;

        if (!array_key_exists($code, $this->validStatusCodes)) {
            throw new Exceptions\InvalidStatusCodeException(
                "'$code' is an invalid status code"
            );
        }

        $this->statusCode = $code;

        return $this;
    }
1343239
public static function get($code)
    {
        try {
            return static::getByAlpha2($code);
        } catch (OutOfBoundsException $e) {
            try {
                return static::getByAlpha3($code);
            } catch (OutOfBoundsException $e) {
                try {
                    return static::getByNumeric3($code);
                } catch (OutOfBoundsException $e) {
                    throw new OutOfBoundsException("The code \"{$code}\" is not listed in ISO 4217");
                }
            }
        }
    }
1371718
public function setCode($code)
    {
        if (!is_scalar($code)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([int|string $code]); %s given.',
                    __METHOD__,
                    is_object($code) ? get_class($code) : gettype($code)
                ),
                E_ERROR
            );
        }

        $this->code = $code;

        return $this;
    }
268412
public function withStatusCode(int $code)
    {
        if ($this->statusCode == $code) {
            return $this;
        }

        $that = clone($this);
        $that->statusCode = $code;
        return $that;
    }
789571
public static function isBodyAllowed($code)
    {
        if (!isset(self::$codesDescriptions[$code])) {
            throw new InvalidArgumentException("Invalid code $code specified");
        }

        return ($code >= self::OK && $code !== self::NO_CONTENT && $code !== self::NOT_MODIFIED);
    }
499031
public function status($code = 200)
    {
        if (!isset(self::$codes[$code])) {
            return false;
        }
        $this->header($code . ' ' . self::$codes[$code]);
        return true;
    }
280015
protected function validate($code)
    {
        $color = str_replace('#', '', DefinedColor::find($code));
        if (strlen($color) === 3) {
            $color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
        }
        return preg_match('/^[a-f0-9]{6}$/i', $color) ? $color : false;
    }
93061
public function setResponseCode(int $code)
    {
        if ($code < 100 || $code > 599)
        {
            $err = new \InvalidArgumentException("Attempting to set status code to $code");
            self::$logger->critical("Invalid status {0}: {1}", [$code, $err]);
            $this->response_code = 500;
        }
        else
        {
            $this->response_code = $code;
        }
        return $this;
    }
1252192
public function setHttpResponseCode($code)
    {
        if (!is_int($code) || (100 > $code) || (599 < $code)) {
            throw new \Exception('Invalid HTTP response code');
        }

        $this->_isRedirect = (300 <= $code) && (307 >= $code);
        $this->_httpResponseCode = $code;
        return $this;
    }
889095
function status($code) {
		$reason=@constant('self::HTTP_'.$code);
		if (!$this->hive['CLI'] && !headers_sent())
			header($_SERVER['SERVER_PROTOCOL'].' '.$code.' '.$reason);
		return $reason;
	}