ice framework documentation ice doc v1.10.1
Methods
  • setProtocolVersion(variable $protocolVersion) : void
  • getStatus() : void
  • setStatus(variable $status) : void
  • getLoops() : void
  • setLoops(variable $loops) : void
  • getRedirects() : void
  • getBody() : void
  • setBody(variable $body) : void
  • __construct(variable $body, int $status) : void
    Response constructor. Fetch Di and set it as a property.
  • getHeaders() : array
    Get HTTP headers.
  • hasHeader(string $name) : bool
    Check whether request have a given header.
  • getHeader(string $name) : string
    Get header value.
  • setHeader(string $name, string $value) : void
    Set header value.
  • setHeaders(array $headers) : void
    Set multiple header values.
  • removeHeader(string $name) : void
    Remove header by index name.
  • setContent(string $contet) : object
    Set body content.
  • finalize(variable $request) : void
    Finalize response for delivery to client.
  • send() : void
    Send HTTP response headers.
  • sendFile(string $filename, string $mime, array $options) : void
    Send file download as the response. All execution will be halted when
  • redirect(string $location, int $status, bool $external) : void
    Redirect to some location.
  • isEmpty() : bool
    Check whether status is for Empty.
  • isInformational() : bool
    Check whether status is for Informational.
  • isOk() : bool
    Check whether status is for OK.
  • isSuccessful() : bool
    Check whether status is for Successful.
  • isRedirect() : bool
    Check whether status is for Redirect.
  • isRedirection() : bool
    Check whether status is for Redirection.
  • isForbidden() : bool
    Check whether status is for Forbidden.
  • isNotFound() : bool
    Check whether status is for Not Found.
  • isClientError() : bool
    Check whether status is for Client error.
  • isServerError() : bool
    Check whether status is for Server Error.
  • getMessage(int $code) : string
    Get message for Response codes.
  • getMessages() : array
    Get all messages.
  • toJson(variable $data, variable $option) : void
    Response data to JSON string.
  • toXml(variable $data, variable $options) : void
    Response data to XML string.
  • xmlEncode(variable $data, string $root, variable $domNode) : void
    Convert data to XML string.
  • __toString() : string
    Magic toString, convert response to string.
  • getByteRange(int $size) : array
Methods Details
  • 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 when
    this 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 worlddont 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.