@param int $code

@return Response
506277
public function getResponse(int $code): Response
    {
        if (!isset($this->responses[$code])) {
            if (isset($this->responses[0])) {
                // Return default response
                return $this->responses[0];
            }
            throw new \InvalidArgumentException(
                "Operation '{$this->getId()}' does not have a definition for status '$code'" .
                " (has " . implode(', ', array_keys($this->responses)) . ')'
            );
        }

        return $this->responses[$code];
    }
970019
public function response($content, $code)
    {
        $this->setJsonHeader();

        $this->setStatusCode($code);

        return $this->content($this->serializer->serialize($content));
    }
1080536
public static function getMessageFromCode($code)
    {
        if (!array_key_exists($code, self::$responseCodes)) {
            throw new \Exception('The header code '.$code.' is not valid.');
        }

        return self::$responseCodes[$code];
    }
882836
public static function back(?int $code = null)
  {
    if (isset(getallheaders()['Referer'])) {
      return Redirect::to(getallheaders()['Referer'], $code);
    }

    return new Redirect('/');
  }
1077250
public final function level(int $code): string
    {
        switch ($code) {
            case 0: return self::ALERT;
            case $this->emergency($code): return self::EMERGENCY;
            case $this->critical($code): return self::CRITICAL;
            case $this->error($code): return self::ERROR;
            case $this->warning($code): return self::WARNING;
            case $this->notice($code): return self::NOTICE;
            case $this->info($code): return self::INFO;
            case $this->debug($code): return self::DEBUG;
            default: return self::ALERT;
        }
    }
495332
public function requestToken($code)
    {
        $parameters = [
            'client_id' => config('twitch-api.client_id'),
            'client_secret' => config('twitch-api.client_secret'),
            'redirect_uri' => config('twitch-api.redirect_url'),
            'code' => $code,
            'grant_type' => 'authorization_code'
        ];

        try {
            $client = new Client();

            $response = $client->post(config('twitch-api.api_url') . '/kraken/oauth2/token', ['body' => $parameters]);

            $response = $response->json();

            if (isset($response[ 'access_token' ])) {

                return $response[ 'access_token' ];
            }

        } catch (\Exception $e) {

            throw $e;
        }
    }
498390
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
  {
    $response = new Response($code);

    \logger()->debug('Created PSR-7 Response (Guzzle)');

    return $response;
  }
127740
public function json($data, int $code = 200): ResponseInterface
    {
        return $this->writeJson($this->responseFactory->createResponse($code), $data, $code);
    }
1152249
public function send($code, $body = '')
    {
        if (!isset($this->codes[$code])) {
            $statusCode = 500;
            $body = 'API attempted to return an unknown HTTP status.';
        }
        // if the body wasn't defined, default to the inbuilt response
        if (!$body) $body = $this->codes[$code];
        header('HTTP/1.1 ' . $code . ' ' . $this->codes[$code]);
        header('Content-type: application/json');
        echo json_encode($body);
        exit;
    }
119213
protected function createRedirectResponse($url, $code = 301)
    {
        $response = $this->getComponentResponseFactory()
            ->createComponentResponse();

        $response->setCode($code)
                 ->getHeaders()
                    ->setHeader('Location', $url);

        return $response;
    }
1133454
final public function abort(int $code) {
		$this->request_handled = true;
		self::$logger->info(sprintf(
			"Router: abort %s: '%s'.",
			$code, $this->request_path));
		if (!method_exists($this, 'abort_custom'))
			$this->abort_default($code);
		else
			$this->abort_custom($code);
		static::halt();
	}
1111221
public function getMessage(int $code): string
    {
        return $this->statusExists($code) ? $this->statuses[$code] : self::UNDEFINED_STATUS_MESSAGE;
    }
283901
public function code(int $code = 200) : Rest
  {
    $this->code = $code;
    header('HTTP/1.1 '.$this->code);
    return $this;
  }
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;
    }
85734
protected function createSimpleResponse($code = 500, $content = 'Unknown error')
    {
        $response = new Response;
        $response->setStatusCode($code)
            ->setContent($content);

        return $response;
    }
961813
public function postReset(Request $request, $code)
    {
        // Validate the form data
        $result = $this->validate($request, [
            'password' => 'required|confirmed|min:6',
        ]);

        // Attempt the password reset
        $result = $this->authManager->resetPassword($code, $request->get('password'));

        if ($result->isFailure()) {
            return $result->dispatch();
        }

        // Return the appropriate response
        return $result->dispatch(route('auth.login.form'));
    }
700838
public static function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
    {
        return self::getResponseFactory()->createResponse($code, $reasonPhrase);
    }