Sets the HTTP status code.

@param int $code The HTTP status code.

@throws ehough_shortstop_api_exception_InvalidArgumentException
If the given code is not an integer between 100 and 599.

@return void
324234
public final function setStatusCode($code)
    {
        if (! is_numeric($code)) {

            throw new ehough_shortstop_api_exception_InvalidArgumentException(
                'Status code must be an integer (' . $code . ')'
            );
        }

        $code = intval($code);

        if ($code < 100 || $code > 599) {

            throw new ehough_shortstop_api_exception_InvalidArgumentException(
                'Status code must be in the range of 100 - 599'
            );
        }

        $this->_statusCode = $code;
    }
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;
    }
378273
protected function setResponseCode()
    {
        if (function_exists('http_status_code')) {
            http_status_code($this->statusCode);
        } else {
            $message = $this->validStatusCodes[$this->statusCode];

            $sapi_type = php_sapi_name();

            if (substr($sapi_type, 0, 3) == 'cgi') {
                $this->headers['Status'] = new Header('Status', $message);
            } else {
                $headerName = "HTTP/1.1 $message";
                $this->headers['Status'] = new Header($headerName);
            }
        }
    }
545103
public static function filterStatusCode(int $code): int
    {
        $filteredCode = \filter_var($code, \FILTER_VALIDATE_INT, ['options' => [
            'min_range' => self::MINIMUM,
            'max_range' => self::MAXIMUM,
        ]]);

        if ($filteredCode === false) {
            throw new InvalidArgumentException(\sprintf(
                'The submitted code "%s" must be a positive integer between %s and %s.',
                $code,
                self::MINIMUM,
                self::MAXIMUM
            ));
        }

        return $code;
    }
545985
protected function setPostcode(string $postcode): void
    {
        if (! preg_match(self::POSTCODE_FORMAT, $postcode)) {
            throw new InvalidArgumentException('Postcode must match the expected format: ' . self::POSTCODE_FORMAT);
        }

        $this->postcode = $postcode;
    }
1353612
protected function validateStatusCode(int $code): int
    {
        if (!is_numeric($code) || is_float($code) || 100 > $code || 599 < $code) {
            throw new InvalidStatusException(
                'Invalid status code. Must be an integer between 100 and 599, inclusive.'
            );
        }

        return $code;
    }
133422
protected static function filterStatus($code)
    {
        if (! is_integer($code) || $code < StatusCode::STATUS_CODE_MIN || $code > StatusCode::STATUS_CODE_MAX) {
            throw new InvalidArgumentException(sprintf(
                'Invalid status code provided; must be an integer between %d and %d, inclusive; received %s',
                StatusCode::STATUS_CODE_MIN,
                StatusCode::STATUS_CODE_MAX,
                (is_object($code) ? get_class($code) : gettype($code))
            ));
        }

        return $code;
    }
646943
public function setCode($code)
    {
        $allowedValues = $this->getCodeAllowableValues();
        if (!in_array($code, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'code', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['code'] = $code;

        return $this;
    }
133813
public function setCookie($code)
    {
        $lifespan = $this->config->get('currency_cookie_lifespan', 365 * 24 * 60 * 60);
        $this->request->setCookie('currency', $code, $lifespan);
    }
1106799
public static function setError($code, $message = '')
    {
        if (!isset(self::$errorCodes[$code])) {
            throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
        }

        self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
        self::$errorCode = $code;
    }
901235
public function setStatus($code, $reasonPhrase = null)
    {
        $this->statusCode   = $code;
        $this->reasonPhrase = $reasonPhrase;
    }
242128
public function setStatus($statusCode)
    {
        $statusCode = @intval($statusCode);

        if ($statusCode < 100 || $statusCode > 599) {
            throw new HTTPException(
                'Invalid response status code'
            );
        } else {
            $this->status = $statusCode;
        }

        return $this;
    }
913314
public function setStatus(int $code, string $status)
    {
        return $this
            ->set('code', $code)
            ->setHeader('Status', $status);
    }
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;
    }
268412
public function withStatusCode(int $code)
    {
        if ($this->statusCode == $code) {
            return $this;
        }

        $that = clone($this);
        $that->statusCode = $code;
        return $that;
    }
504423
protected function assertStatusCode($code)
    {
        if (!is_int($code) && !(is_string($code) && ctype_digit($code))) {
            throw new \InvalidArgumentException("Response code must be integer");
        }
        
        if ($code < 100 || $code > 999) {
            throw new \InvalidArgumentException("Response code must be in range 100...999");
        }
    }
1229734
public function setOpcode($opcode)
    {
        if (!self::validateOpcode($opcode)) {
            throw new InvalidArgumentException("Invalid opcode");
        }

        $this->firstFrameByte = $this->firstFrameByte & 240;
        $this->firstFrameByte |= $opcode;
    }