Elgg  Version master
ResponseBuilder.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Http;
4 
7 
13 interface ResponseBuilder {
14 
22  public function setContent($content = '');
23 
28  public function getContent();
29 
37  public function setStatusCode(int $status_code);
38 
43  public function getStatusCode();
44 
52  public function setForwardURL(string $forward_url = REFERRER);
53 
58  public function getForwardURL(): ?string;
59 
66  public function setHeaders(array $headers = []);
67 
72  public function getHeaders();
73 
78  public function isInformational();
79 
84  public function isSuccessful();
85 
90  public function isRedirection();
91 
96  public function isClientError();
97 
102  public function isServerError();
103 
108  public function isOk();
109 
114  public function isNotModified();
115 
123  public function setException(\Exception $e);
124 
130  public function getException();
131 }
HTTP response builder interface.
getStatusCode()
Returns status code.
isRedirection()
Check if response is redirection.
getContent()
Returns response body.
isNotModified()
Check if response has been modified.
isOk()
Check if response is OK.
isInformational()
Check if response is informational.
isServerError()
Check if response is server error.
const REFERRER
Used in calls to forward() to specify the browser should be redirected to the referring page...
Definition: constants.php:37
isSuccessful()
Check if response is successful.
if(!$entity->delete(true, true)) $forward_url
Definition: delete.php:30
setForwardURL(string $forward_url=REFERRER)
Sets redirect URL.
setException(\Exception $e)
Set an exception for this response.
setStatusCode(int $status_code)
Sets response HTTP status code.
isClientError()
Check if response is client error.
getException()
Get the exception for this reponse.
$content
Set robots.txt action.
Definition: set_robots.php:6
setHeaders(array $headers=[])
Sets additional response headers.
setContent($content= '')
Sets response body.
getHeaders()
Returns additional response headers.
getForwardURL()
Returns redirect URL.