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 }
$error
Bad request error.
Definition: 400.php:6
Error response builder.
__construct($error='', int $status_code=ELGG_HTTP_BAD_REQUEST, string $forward_url=REFERRER)
Constructor.
Response builder.
Definition: Response.php:14
setForwardURL(string $forward_url=REFERRER)
{Sets redirect URL.Forward URL self }
Definition: Response.php:84
string $forward_url
Definition: Response.php:20
setContent($content='')
{Sets response body.Content of the response as a scalar value or an array self }
Definition: Response.php:31
setStatusCode(int $status_code)
{Sets response HTTP status code.Status code self }
Definition: Response.php:65
const ELGG_HTTP_INTERNAL_SERVER_ERROR
Definition: constants.php:91
const ELGG_HTTP_BAD_REQUEST
Definition: constants.php:64
const REFERRER
Used in calls to forward() to specify the browser should be redirected to the referring page.
Definition: constants.php:37