Check if the code exists in a collection.

@param int $statusCode http status code

@throws InvalidArgumentException If the requested $statusCode is not valid

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

        return isset($this->httpStatus[$statusCode]);
    }
1358633
public function setStatus($statusCode)
    {
        if ($this->statusCode === null) {
            $this->statusCode = $statusCode;
            $this->response->setStatusCode($statusCode);
        }
    }
539859
public function hasReasonPhrase($statusText)
    {
        try {
            $statusText = $this->filterReasonPhrase($statusText);
        } catch (InvalidArgumentException $e) {
            return false;
        }

        return (bool) $this->fetchStatusCode($statusText);
    }
736274
protected function checkResultCode($code)
    {
        if ($this->code > 1000) {
            throw new OutOfRangeException("Result code [$code] out of range");
        } elseif (false === $this->getConstant($this->code)) {
            throw new InvalidArgumentException("Invalid result code [$code]");
        }
    }
1091019
public function setStatusCode(int $statusCode, string $statusText = null)
    {
        $this->statusCode = $statusCode;

        if ($statusText === null && isset(ResponseHeaders::$statusTexts[$statusCode])) {
            $this->statusText = ResponseHeaders::$statusTexts[$statusCode];
        } else {
            $this->statusText = $statusText;
        }
    }
1162996
protected function filtreCode($code)
    {
        if (is_numeric($code)) {
            $code = (int) $code;
        }
        if (!isset($this->reasonPhraseDefault[ $code ])) {
            throw new \InvalidArgumentException('Status code is invalid.');
        }

        return $code;
    }
1011071
public function setHttpStatusCode($httpStatusCode) {
		if (Validator::checkHttpStatusCode($httpStatusCode) === false) {
			throw new InputException('can not use an invalid http status code');
		}
		
		$this->httpStatusCode = $httpStatusCode;
	}
848689
public function setStatusCode(int $statusCode): self
    {
        if (!array_key_exists($statusCode, Response::$statusTexts)) {
            $this->internalServerError('Invalid status code in ' . __METHOD__, Response::$statusTexts);
        }

        $this->statusCode = $statusCode;

        return $this;
    }
1331864
public static function isValidCode($code)
    {
        if (array_key_exists($code, self::getInfoForCurrencies())) {
            return true;
        } elseif (array_key_exists($code, self::getInfoForCurrenciesWithoutCurrencyCode())) {
            return true;
        } elseif (array_key_exists($code, self::getInfoForCurrenciesWithUnofficialCode())) {
            return true;
        } elseif (array_key_exists($code, self::getInfoForCurrenciesWithHistoricalCode())) {
            return true;
        } else {
            return false;
        }
    }
704048
public function withStatus($code, $reason = '')
    {
        $code = Validator::checkCode($code);

        if (!is_string($reason) && !method_exists($reason, '__toString')) {
            throw new InvalidArgumentException('ReasonPhrase must be a string');
        }

        $clone = clone $this;
        $clone->code = $code;
        if ($reason === '') {
            $reason = Validator::getCodeMessage($code);
        }

        if ($reason === '') {
            throw new InvalidArgumentException('ReasonPhrase must be supplied for this code');
        }

        $clone->phrase = $reason;

        return $clone;
    }
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;
    }
410860
public static function isSuccessful(int $statusCode): bool
    {
        return ($statusCode >= HttpStatus::SUCCESSFUL) && ($statusCode < HttpStatus::REDIRECTION);
    }
541325
protected function guessFile($statusCode)
    {
        $fileName = sprintf('%s/%s.html', $this->templatePath, (int) $statusCode);

        if (is_readable($fileName)) {
            return $fileName;
        } else {
            return $this->defaultErrorFileName;
        }
    }
1243685
protected function status($status, $code)
	{
		$data = $this->getStatusData($status);
		return $this->jsonResponse($data, $code);
	}
626127
public function setStatusHelper($statusCode)
    {
        if (null !== $ordeStatus = OrderStatusQuery::create()->findOneByCode($statusCode)) {
            $this->setOrderStatus($ordeStatus)->save();
        }
    }
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;
    }
72928
private function checkSignature($signature, $status, $code)
    {
        if (!$signature) {
            throw new EndpointException("Invalid signature");
        }
      
        $data = $this->app->getAppId() . $this->requestId . $this->connectId . $code . $status;
        $result = openssl_verify($data, $signature, $this->app->getSecretKey(), OPENSSL_ALGO_SHA512);
        
        if ($result < 1) {
            $errstr = openssl_error_string();

            throw new EndpointException("Invalid signature or an openssl error (" . ($errstr ? $errstr : "-") . ")");
        }
    }