Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HttpResponse Class Reference

Public Member Functions

 send ()
 Send the response, including all headers.
 
 sendHeaders ()
 Send all headers.
 
 setHeader ($name, $value, $replace=false)
 Set a header.
 
 getHeader ($name)
 Check if a specific Header is set and return its value.
 
 getHeaders ()
 Return array of headers; see $headers for format.
 
 canSendHeaders ($throw=false)
 Can we send headers?
 
 setStatusCode ($code)
 Set HTTP response code to use with headers.
 
 getStatusCode ()
 Retrieve HTTP response code.
 
 setContent ($content)
 Set body content.
 
 getContent ()
 Return the body content.
 

Protected Member Functions

 _normalizeHeader ($name)
 Normalizes a header name to X-Capitalized-Names.
 

Protected Attributes

 $content = ''
 
 $headers = []
 
 $statusCode = 200
 

Member Function Documentation

_normalizeHeader (   $name)
protected

Normalizes a header name to X-Capitalized-Names.

Parameters
string$name
Returns
string
canSendHeaders (   $throw = false)

Can we send headers?

Parameters
bool$throwWhether or not to throw an exception if headers have been sent; defaults to false
Returns
HttpResponse
Exceptions
Exception\RuntimeException
getContent ( )

Return the body content.

Returns
string
getHeader (   $name)

Check if a specific Header is set and return its value.

Parameters
string$name
Returns
string|null
getHeaders ( )

Return array of headers; see $headers for format.

Returns
array
getStatusCode ( )

Retrieve HTTP response code.

Returns
int
send ( )

Send the response, including all headers.

Returns
void
sendHeaders ( )

Send all headers.

Sends any headers specified. If an HTTP response code has been specified, it is sent with the first header.

Returns
void
setContent (   $content)

Set body content.

Parameters
string$content
Returns
setHeader (   $name,
  $value,
  $replace = false 
)

Set a header.

If $replace is true, replaces any headers already defined with that $name.

Parameters
string$name
string$value
bool$replace
Returns
setStatusCode (   $code)

Set HTTP response code to use with headers.

Parameters
int$code
Returns
HttpResponse
Exceptions
Exception\InvalidArgumentException

Member Data Documentation

$content = ''
protected
$headers = []
protected
$statusCode = 200
protected