Elgg  Version master
ErrorResponse.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Http;
4 
8 class ErrorResponse extends Response {
9 
19  public function __construct($error = '', int $status_code = ELGG_HTTP_BAD_REQUEST, string $forward_url = REFERRER) {
20  if ($status_code < 100 || $status_code > 599) {
22  }
23 
24  $this->setContent($error);
27  }
28 }
string $forward_url
Definition: Response.php:20
Response builder.
Definition: Response.php:14
Error response builder.
setStatusCode(int $status_code)
{Sets response HTTP status code.Status code self }
Definition: Response.php:65
setForwardURL(string $forward_url=REFERRER)
{Sets redirect URL.Forward URL self }
Definition: Response.php:84
$error
Bad request error.
Definition: 400.php:6
const REFERRER
Used in calls to forward() to specify the browser should be redirected to the referring page...
Definition: constants.php:37
setContent($content= '')
{Sets response body.Content of the response as a scalar value or an array self }
Definition: Response.php:31
const ELGG_HTTP_BAD_REQUEST
Definition: constants.php:64
const ELGG_HTTP_INTERNAL_SERVER_ERROR
Definition: constants.php:91
__construct($error= '', int $status_code=ELGG_HTTP_BAD_REQUEST, string $forward_url=REFERRER)
Constructor.