Execute forward, with options HTTP status code
@param integer $code
963741
public function execute($code = null) {

		if(null !== $code && false === ('-' . intval($code) == '-' . $code)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($code)), E_USER_ERROR);
		}

		$this -> setUrl();

		if(null !== $this -> seconds) {
			return Response :: addHeader('refresh', sprintf('%d;url=%s', $this -> seconds, $this -> url), $code);
		}

		Response :: addHeader('Location', $this -> url, $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;
	}
823971
static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
		$text = self::getText( $code );
		header( $protocol.' '.$code.' '.$text );
	}
8847
public function setStatusCode($code = null)
    {
        if (!empty($code)) {
            $this->_statusCode = $code;
            http_response_code($this->_statusCode); // this sends the http status code
        }
    }
252894
private function redirect(string $location, int $code): void
    {
        if (function_exists('redirect_with')) {
            redirect_with($location, $code); // http/sugars.php
        } elseif (!headers_sent()) {
            header('Location: '. $location, false, $code);
            $location = htmlspecialchars($location);
            die('Redirecting to <a href="'. $location .'">'. $location .'</a>'); // yes..
        }
    }
1346461
public static function sendResponseCode($code)
    {
        $messages = array(
            200 => 'Ok',
            204 => 'No Response',
            301 => 'Moved Permanently',
            302 => 'Found',
            304 => 'Not Modified',
            400 => 'Bad Request',
            401 => 'Unauthorized',
            403 => 'Forbidden',
            404 => 'Not Found',
            500 => 'Internal Server Error',
            503 => 'Service Unavailable',
        );

        if (!array_key_exists($code, $messages)) {
            throw new Exception('Response code not supported: ' . $code);
        }

        if (strpos(PHP_SAPI, '-fcgi') === false) {
            $key = 'HTTP/1.1';

            if (array_key_exists('SERVER_PROTOCOL', $_SERVER)
                && strlen($_SERVER['SERVER_PROTOCOL']) < 15
                && strlen($_SERVER['SERVER_PROTOCOL']) > 1) {
                $key = $_SERVER['SERVER_PROTOCOL'];
            }
        } else {
            // FastCGI
            $key = 'Status:';
        }

        $message = $messages[$code];
        Common::sendHeader($key . ' ' . $code . ' ' . $message);
    }
1061201
public function error(ServerRequestInterface $request, int $code = 0, string $msg = null, ...$args): ServerRequestInterface
    {
        $routing = $request->getAttribute('routing');

        if (empty($routing)) {
            return $request;
        }

        if ($msg !== null && $args !== []) {
            $msg = \sprintf($msg, ...$args);
        }

        $error = new ActionError($msg, $code);
        $forwardTo = $error->getForwardTo();
        $forwardTo['handler'] += $this->app->getRealHandler($routing['handler']);;

        return $request->withAttribute('routing', $forwardTo);
    }
1245090
private function assertStatusCodeEquals($code)
    {
        if (!$this->getSession()->getDriver() instanceof Selenium2Driver) {
            $this->assertSession()->statusCodeEquals($code);
        }
    }
456612
private function validateStatus($code)
    {
        if (! is_numeric($code)
            || is_float($code)
            || $code < 100
            || $code >= 600
        ) {
            throw new InvalidArgumentException(sprintf(
                'Invalid status code "%s"; must be an integer between 100 and 599, inclusive',
                (is_scalar($code) ? $code : gettype($code))
            ));
        }
    }
617274
function redirect(int $code, string $url): \Nofuzz\Http\HTTPResponse
  {
    $this->setStatusCode($code);
    $this->setHeader('Location',$url);
    $this->setBody('');

    return $this;
  }
565829
private function response($code)
    {
        switch ($code) {
            // Successful
            case 200:
            case 304:
                return $this->success();
            // Non existent user
            case 403: // Forbidden:
                return $this->forbidden();
            case 404: // Removed
                return $this->requestDoesNotExist();
            // Rate limit
            case 429:
                return $this->rateLimit();
            // OAuth Credentials are NOT VALID or others
            case 400:
            default:
                return $this->generalError();
        }
    }
616564
public function setHttpResponseCode($code)
        {
            if (!is_int($code) || (100 > $code) || (599 < $code)) {
                throw new Exception('Invalid HTTP response code');
            }

            if ((300 <= $code) && (307 >= $code)) {
                $this->_isRedirect = true;
            } else {
                $this->_isRedirect = false;
            }

            $this->_httpResponseCode = $code;

            return $this;
        }
62748
public function setStatusHeader($code = 200)
    {
        if (!$this->controller->canEnd()) {
            return;
        }
        $this->response->status($code);
        return $this;
    }
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;
    }
1029473
public function httpError($code)
    {
        switch ($code)
        {
            case 400:
                throw new Eresus_HTTP_Exception_BadRequest;
            case 401:
                throw new Eresus_HTTP_Exception_Unauthorized;
            case 402:
                throw new Eresus_HTTP_Exception_PaymentRequired;
            case 403:
                throw new Eresus_HTTP_Exception_Forbidden;
            case 404:
                throw new Eresus_HTTP_Exception_NotFound;
            default:
                throw new Eresus_HTTP_Exception('', $code);
        }
    }
597863
public function setCode(string $code)
    {
        if ($code) {
            $this->selectLocale = strtolower($code);
            $this->ready = true;    // set ready for use locale
            $this->checkLocale();
        }
//        \Tracy\Debugger::fireLog('setCode: ' . $code);
    }
747861
private function setStatusCode($code, $reasonPhrase = ''): void
    {
        if (
            !\is_numeric($code) || \is_float($code) ||
            $code < static::MIN_STATUS_CODE_VALUE ||
            $code > static::MAX_STATUS_CODE_VALUE
        ) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid status code "%s"; must be an integer between %d and %d, inclusive',
                \is_scalar($code) ? $code : \gettype($code),
                static::MIN_STATUS_CODE_VALUE,
                static::MAX_STATUS_CODE_VALUE
            ));
        }

        if (!\is_string($reasonPhrase)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unsupported response reason phrase; must be a string, received %s',
                \is_object($reasonPhrase) ? \get_class($reasonPhrase) : \gettype($reasonPhrase)
            ));
        }

        if ($reasonPhrase === '' && isset($this->phrases[$code])) {
            $reasonPhrase = self::$phrases[$code];
        }

        $this->reasonPhrase = $reasonPhrase;
        $this->statusCode = (int) $code;
    }