-
getProtocolVersion() : void
-
-
getStatus() : void
-
-
getLoops() : void
-
-
getRedirects() : void
-
getBody() : void
-
-
Response constructor. Fetch Di and set it as a property.
-
getHeaders() : arrayGet HTTP headers.
-
Check whether request have a given header.
-
Get header value.
-
Set header value.
-
Set multiple header values.
-
Remove header by index name.
-
Set body content.
-
Finalize response for delivery to client.
-
send() : voidSend HTTP response headers.
-
Send file download as the response. All execution will be halted when
-
Redirect to some location.
-
isEmpty() : boolCheck whether status is for Empty.
-
isInformational() : boolCheck whether status is for Informational.
-
isOk() : boolCheck whether status is for OK.
-
isSuccessful() : boolCheck whether status is for Successful.
-
isRedirect() : boolCheck whether status is for Redirect.
-
isRedirection() : boolCheck whether status is for Redirection.
-
isForbidden() : boolCheck whether status is for Forbidden.
-
isNotFound() : boolCheck whether status is for Not Found.
-
isClientError() : boolCheck whether status is for Client error.
-
isServerError() : boolCheck whether status is for Server Error.
-
Get message for Response codes.
-
getMessages() : arrayGet all messages.
-
Response data to JSON string.
-
Response data to XML string.
-
Convert data to XML string.
-
__toString() : stringMagic toString, convert response to string.
-
-
public function getProtocolVersion()
-
public function setProtocolVersion(variable $protocolVersion)
-
public function getStatus()
-
public function setStatus(variable $status)
-
public function getLoops()
-
public function setLoops(variable $loops)
-
public function getRedirects()
-
public function getBody()
-
public function setBody(variable $body)
-
public function __construct(variable $body, int $status)
Response constructor. Fetch Di and set it as a property. -
public function getHeaders()
Get HTTP headers. -
public function hasHeader(string $name)
Check whether request have a given header. -
public function getHeader(string $name)
Get header value. -
public function setHeader(string $name, string $value)
Set header value. -
public function setHeaders(array $headers)
Set multiple header values. -
public function removeHeader(string $name)
Remove header by index name. -
public function setContent(string $contet)
Set body content. -
public function finalize(variable $request)
Finalize response for delivery to client.Apply final preparations to the resposne object so that it is suitable for delivery to the client. -
public function send()
Send HTTP response headers. -
public function sendFile(string $filename, string $mime, array $options)
Send file download as the response. All execution will be halted whenthis method is called! The third parameter allows the following options to be set: Type | Option | Description | Default Value ----------|-----------|------------------------------------|-------------- string | file | file that already exists | null boolean | inline | Display inline instead of download | FALSE boolean | resumable | Allow to resumable download | FALSE boolean | delete | Delete the file after sending | FALSE int | timeout | Execute time for the script | 0 int | speed | Download speed in millisecond | 0 Download a file that already exists: $request->sendFile('ice.zip', 'application/zip', ['file' => '/download/latest.zip']); Download generated content as a file: $response->setContent($content); $response->sendFile($filename, $mineType); Attention: No further processing can be done after this method is called! -
public function redirect(string $location, int $status, bool $external)
Redirect to some location.This method prepares the response object to return an HTTP Redirect response to the client. -
public function isEmpty()
Check whether status is for Empty. -
public function isInformational()
Check whether status is for Informational. -
public function isOk()
Check whether status is for OK. -
public function isSuccessful()
Check whether status is for Successful. -
public function isRedirect()
Check whether status is for Redirect. -
public function isRedirection()
Check whether status is for Redirection. -
public function isForbidden()
Check whether status is for Forbidden. -
public function isNotFound()
Check whether status is for Not Found. -
public function isClientError()
Check whether status is for Client error. -
public function isServerError()
Check whether status is for Server Error. -
public function getMessage(int $code)
Get message for Response codes. -
public function getMessages()
Get all messages. -
public function toJson(variable $data, variable $option)
Response data to JSON string. -
public function toXml(variable $data, variable $options)
Response data to XML string.$response->toXml( [['title' => 'hello world', 'desc' => 'dont panic']], ['root' => 'blogs', 'namespace' => 'http://example.com/xml/blog'] ); // This will output the xml
hello world dont panic -
public function xmlEncode(variable $data, string $root, variable $domNode)
Convert data to XML string. -
public function __toString()
Magic toString, convert response to string. -
protected function getByteRange(int $size)
At the moment we only support single ranges. Multiple ranges requires some more work to ensure it works correctly and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 Multirange support annouces itself with: header('Accept-Ranges: bytes'); Multirange content must be sent with multipart/byteranges mediatype, as well as a boundry header to indicate the various chunks of data.