HTTP Response for current PHP environment

package Default
inherited_from \Zend\Http\Response

 Methods

Allow PHP casting of this object

__toString() : string
Inherited

Returns

string

contentSent()

contentSent() : boolean

Returns

boolean

Populate object from string

fromString(string $string) : \Zend\Http\PhpEnvironment\Response
InheritedStatic
fluent This method is part of a fluent interface and will return the same instance

Parameters

$string

string

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\PhpEnvironment\Response

Get the body of the response

getBody() : string
Inherited

Returns

string

Get message content

getContent() : mixed
Inherited
inherited_from \Zend\Stdlib\MessageInterface::getContent()

Returns

mixed

getCookie()

getCookie() : array<mixed,\Zend\Http\Header\SetCookie>
Inherited

Returns

array<mixed,\Zend\Http\Header\SetCookie>

Return the header container responsible for headers

getHeaders() : \Zend\Http\Headers
Inherited

Returns

\Zend\Http\Headers

Get HTTP status message

getReasonPhrase() : string
Inherited

Returns

string

Retrieve HTTP status code

getStatusCode() : integer
Inherited

Returns

integer

Return the HTTP version for this response

getVersion() : string
see

Returns

string

Return the HTTP version for this request

getVersion() : string
Inherited

Returns

string

headersSent()

headersSent() : boolean

Returns

boolean

Does the status code indicate a client error?

isClientError() : boolean
Inherited

Returns

boolean

Is the request forbidden due to ACLs?

isForbidden() : boolean
Inherited

Returns

boolean

Is the current status "informational"?

isInformational() : boolean
Inherited

Returns

boolean

Does the status code indicate the resource is not found?

isNotFound() : boolean
Inherited

Returns

boolean

Do we have a normal, OK response?

isOk() : boolean
Inherited

Returns

boolean

Do we have a redirect?

isRedirect() : boolean
Inherited

Returns

boolean

Does the status code reflect a server error?

isServerError() : boolean
Inherited

Returns

boolean

Was the response successful?

isSuccess() : boolean
Inherited

Returns

boolean

Render the status line header

renderStatusLine() : string
Inherited

Returns

string

Send HTTP response

send() : \Zend\Http\PhpEnvironment\Response

Returns

\Zend\Http\PhpEnvironment\Response

Send content

sendContent() : \Zend\Http\PhpEnvironment\Response

Returns

\Zend\Http\PhpEnvironment\Response

Send HTTP headers

sendHeaders() : \Zend\Http\PhpEnvironment\Response

Returns

\Zend\Http\PhpEnvironment\Response

Set message content

setContent(mixed $value) : \Zend\Stdlib\Message
Inherited
inherited_from \Zend\Stdlib\MessageInterface::setContent()

Parameters

$value

mixed

Returns

\Zend\Stdlib\Message

Set custom HTTP status code

setCustomStatusCode(integer $code) : \Zend\Http\PhpEnvironment\Response
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$code

integer

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\PhpEnvironment\Response

Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())

setHeaders(\Zend\Http\Headers $headers) : \Zend\Http\AbstractMessage
Inherited
see

Parameters

$headers

\Zend\Http\Headers

Returns

\Zend\Http\AbstractMessage

setReasonPhrase()

setReasonPhrase(string $reasonPhrase) : \Zend\Http\PhpEnvironment\Response
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$reasonPhrase

string

Returns

\Zend\Http\PhpEnvironment\Response

Set HTTP status code and (optionally) message

setStatusCode(integer $code) : \Zend\Http\PhpEnvironment\Response
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$code

integer

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\PhpEnvironment\Response

Set the HTTP version for this object, one of 1.0 or 1.1 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)

setVersion(string $version) : \Zend\Http\AbstractMessage
Inherited

Parameters

$version

string

(Must be 1.0 or 1.1)

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

\Zend\Http\AbstractMessage

toString()

toString() : string
Inherited

Returns

string

Decode a "chunked" transfer-encoded body and return the decoded text

decodeChunkedBody(string $body) : string
Inherited

Parameters

$body

string

Exceptions

\Zend\Http\Exception\RuntimeException

Returns

string

Decode a zlib deflated message (when Content-encoding = deflate)

decodeDeflate(string $body) : string
Inherited

Currently requires PHP with zlib support

Parameters

$body

string

Exceptions

\Zend\Http\Exception\RuntimeException

Returns

string

Decode a gzip encoded message (when Content-encoding = gzip)

decodeGzip(string $body) : string
Inherited

Currently requires PHP with zlib support

Parameters

$body

string

Exceptions

\Zend\Http\Exception\RuntimeException

Returns

string

Detect the current used protocol version.

detectVersion() : string

If detection failed it falls back to version 1.0.

Returns

string

Assign status code

saveStatusCode(integer $code) : \Zend\Http\PhpEnvironment\Response
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$code

integer

Returns

\Zend\Http\PhpEnvironment\Response

 Properties

 

$content

$content : string

Default

''
 

$contentSent

$contentSent : boolean

Default

false
 

$headers

$headers : \Zend\Http\Headers | null

Default

null
   

Null means it will be looked up from the $reasonPhrase list above

$reasonPhrase : string | null

Default

null
 

Recommended Reason Phrases

$recommendedReasonPhrases : array

Default

array(100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 511 => 'Network Authentication Required')
 

Status code

$statusCode : integer

Default

200
 

The current used version (The value will be detected on getVersion)

$version : null | string

Default

 

$version

$version : string

Default

self::VERSION_11

 Constants

 

STATUS_CODE_100

STATUS_CODE_100 = 100 
 

STATUS_CODE_101

STATUS_CODE_101 = 101 
 

STATUS_CODE_102

STATUS_CODE_102 = 102 
 

STATUS_CODE_200

STATUS_CODE_200 = 200 
 

STATUS_CODE_201

STATUS_CODE_201 = 201 
 

STATUS_CODE_202

STATUS_CODE_202 = 202 
 

STATUS_CODE_203

STATUS_CODE_203 = 203 
 

STATUS_CODE_204

STATUS_CODE_204 = 204 
 

STATUS_CODE_205

STATUS_CODE_205 = 205 
 

STATUS_CODE_206

STATUS_CODE_206 = 206 
 

STATUS_CODE_207

STATUS_CODE_207 = 207 
 

STATUS_CODE_208

STATUS_CODE_208 = 208 
 

STATUS_CODE_300

STATUS_CODE_300 = 300 
 

STATUS_CODE_301

STATUS_CODE_301 = 301 
 

STATUS_CODE_302

STATUS_CODE_302 = 302 
 

STATUS_CODE_303

STATUS_CODE_303 = 303 
 

STATUS_CODE_304

STATUS_CODE_304 = 304 
 

STATUS_CODE_305

STATUS_CODE_305 = 305 
 

STATUS_CODE_306

STATUS_CODE_306 = 306 
 

STATUS_CODE_307

STATUS_CODE_307 = 307 
 

STATUS_CODE_400

STATUS_CODE_400 = 400 
 

STATUS_CODE_401

STATUS_CODE_401 = 401 
 

STATUS_CODE_402

STATUS_CODE_402 = 402 
 

STATUS_CODE_403

STATUS_CODE_403 = 403 
 

STATUS_CODE_404

STATUS_CODE_404 = 404 
 

STATUS_CODE_405

STATUS_CODE_405 = 405 
 

STATUS_CODE_406

STATUS_CODE_406 = 406 
 

STATUS_CODE_407

STATUS_CODE_407 = 407 
 

STATUS_CODE_408

STATUS_CODE_408 = 408 
 

STATUS_CODE_409

STATUS_CODE_409 = 409 
 

STATUS_CODE_410

STATUS_CODE_410 = 410 
 

STATUS_CODE_411

STATUS_CODE_411 = 411 
 

STATUS_CODE_412

STATUS_CODE_412 = 412 
 

STATUS_CODE_413

STATUS_CODE_413 = 413 
 

STATUS_CODE_414

STATUS_CODE_414 = 414 
 

STATUS_CODE_415

STATUS_CODE_415 = 415 
 

STATUS_CODE_416

STATUS_CODE_416 = 416 
 

STATUS_CODE_417

STATUS_CODE_417 = 417 
 

STATUS_CODE_418

STATUS_CODE_418 = 418 
 

STATUS_CODE_422

STATUS_CODE_422 = 422 
 

STATUS_CODE_423

STATUS_CODE_423 = 423 
 

STATUS_CODE_424

STATUS_CODE_424 = 424 
 

STATUS_CODE_425

STATUS_CODE_425 = 425 
 

STATUS_CODE_426

STATUS_CODE_426 = 426 
 

STATUS_CODE_428

STATUS_CODE_428 = 428 
 

STATUS_CODE_429

STATUS_CODE_429 = 429 
 

STATUS_CODE_431

STATUS_CODE_431 = 431 
 

STATUS_CODE_500

STATUS_CODE_500 = 500 
 

STATUS_CODE_501

STATUS_CODE_501 = 501 
 

STATUS_CODE_502

STATUS_CODE_502 = 502 
 

STATUS_CODE_503

STATUS_CODE_503 = 503 
 

STATUS_CODE_504

STATUS_CODE_504 = 504 
 

STATUS_CODE_505

STATUS_CODE_505 = 505 
 

STATUS_CODE_506

STATUS_CODE_506 = 506 
 

STATUS_CODE_507

STATUS_CODE_507 = 507 
 

STATUS_CODE_508

STATUS_CODE_508 = 508 
 

STATUS_CODE_511

STATUS_CODE_511 = 511 
 

STATUS_CODE_CUSTOM

STATUS_CODE_CUSTOM = 0 
 

VERSION_10

VERSION_10 = '1.0' 
 

VERSION_11

VERSION_11 = '1.1'