Class DownloadResponse

Summary

Fully Qualified Name: CodeIgniter\HTTP\DownloadResponse
Extends: Message
Implements: ResponseInterface

Description

HTTP response when a download is requested.

Methods

Name Description Defined By
__construct() Constructor. DownloadResponse
appendBody() Appends data to the body of the current message. Message
appendHeader() Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess) Message
buildHeaders() set header for file download. DownloadResponse
getBody() Returns the Message's body. Message
getContentLength() get content length. DownloadResponse
getHeader() Returns a single header object. If multiple headers with the same name exist, then will return an array of header objects. Message
getHeaderLine() Retrieves a comma-separated string of the values for a single header. Message
getHeaders() Returns an array containing all headers. Message
getProtocolVersion() Returns the HTTP Protocol Version. Message
getReason() {@inheritDoc} DownloadResponse
getStatusCode() {@inheritDoc} DownloadResponse
hasHeader() Determines whether a header exists. Message
noCache() {@inheritDoc} DownloadResponse
populateHeaders() Populates the $headers array with any headers the getServer knows about. Message
prependHeader() Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess) Message
pretend() For unit testing, don't actually send headers. DownloadResponse
removeHeader() Removes a header from the list of headers we track. Message
send() {@inheritDoc} DownloadResponse
sendBody() output download file text. DownloadResponse
sendHeaders() Sends the headers of this HTTP request to the browser. DownloadResponse
setBinary() set download for binary string. DownloadResponse
setBody() Sets the body of the current message. Message
setCache() {@inheritDoc} DownloadResponse
setContentType() {@inheritDoc} DownloadResponse
setDate() {@inheritDoc} DownloadResponse
setFileName() set name for the download. DownloadResponse
setFilePath() set download for file. DownloadResponse
setHeader() Sets a header and it's value. Message
setLastModified() {@inheritDoc} DownloadResponse
setProtocolVersion() Sets the HTTP protocol version. Message
setStatusCode() {@inheritDoc} DownloadResponse

Method Details

__construct()

Constructor.

Parameter Name Type Description
$filename string
$setMime bool

Returns:

appendBody()

Appends data to the body of the current message.

Parameter Name Type Description
$data
$data

Returns: \Message|\Response

appendHeader()

Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)

Parameter Name Type Description
$name string
$value string

Returns: \Message

buildHeaders()

set header for file download.

Returns:

getBody()

Returns the Message's body.

Returns: mixed

getContentLength()

get content length.

Returns: int

getHeader()

Returns a single header object. If multiple headers with the same name exist, then will return an array of header objects.

Parameter Name Type Description
$name string

Returns: array|\CodeIgniter\HTTP\Header

getHeaderLine()

Retrieves a comma-separated string of the values for a single header.

This method returns all of the header values of the given case-insensitive header name as a string concatenated together using a comma.

NOTE: Not all header values may be appropriately represented using comma concatenation. For such headers, use getHeader() instead and supply your own delimiter when concatenating.

Parameter Name Type Description
$name string

Returns: string

getHeaders()

Returns an array containing all headers.

Returns: array An array of the request headers

getProtocolVersion()

Returns the HTTP Protocol Version.

Returns: string

getReason()

{@inheritDoc}

Returns:

getStatusCode()

{@inheritDoc}

Returns:

hasHeader()

Determines whether a header exists.

Parameter Name Type Description
$name string

Returns: bool

noCache()

{@inheritDoc}

Returns:

populateHeaders()

Populates the $headers array with any headers the getServer knows about.

Returns:

prependHeader()

Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)

Parameter Name Type Description
$name string
$value string

Returns: \Message

pretend()

For unit testing, don't actually send headers.

Parameter Name Type Description
$pretend bool

Returns: $this

removeHeader()

Removes a header from the list of headers we track.

Parameter Name Type Description
$name string

Returns: \Message

send()

{@inheritDoc}

Returns:

sendBody()

output download file text.

Returns: \DownloadResponse

sendHeaders()

Sends the headers of this HTTP request to the browser.

Returns: \DownloadResponse

setBinary()

set download for binary string.

Parameter Name Type Description
$binary string

Returns:

setBody()

Sets the body of the current message.

Parameter Name Type Description
$data mixed

Returns: \Message|\Response

setCache()

{@inheritDoc}

Parameter Name Type Description
$options

Returns:

setContentType()

{@inheritDoc}

Parameter Name Type Description
$mime
$charset

Returns:

setDate()

{@inheritDoc}

Parameter Name Type Description
$date

Returns:

setFileName()

set name for the download.

Parameter Name Type Description
$filename string

Returns: $this

setFilePath()

set download for file.

Parameter Name Type Description
$filepath string

Returns:

setHeader()

Sets a header and it's value.

Parameter Name Type Description
$name string
$value array|null|string

Returns: \Message|\Response

setLastModified()

{@inheritDoc}

Parameter Name Type Description
$date

Returns:

setProtocolVersion()

Sets the HTTP protocol version.

Parameter Name Type Description
$version string

Returns: \Message

setStatusCode()

{@inheritDoc}

Parameter Name Type Description
$code
$reason

Returns:

Top