Zend Framework  3.0
Public Member Functions | List of all members
TextResponse Class Reference

Plain text response. More...

Public Member Functions

 __construct ($text, $status=200, array $headers=[])
 Create a plain text response.
 
- Public Member Functions inherited from Response
 __construct ($body= 'php://memory', $status=200, array $headers=[])
 
 getStatusCode ()
 {}
 
 getReasonPhrase ()
 {}
 
 withStatus ($code, $reasonPhrase= '')
 {}
 

Detailed Description

Plain text response.

Allows creating a response by passing a string to the constructor; by default, sets a status code of 200 and sets the Content-Type header to text/plain.

Constructor & Destructor Documentation

__construct (   $text,
  $status = 200,
array  $headers = [] 
)

Create a plain text response.

Produces a text response with a Content-Type of text/plain and a default status of 200.

Parameters
string | StreamInterface$textString or stream for the message body.
int$statusInteger status code for the response; 200 by default.
array$headersArray of headers to use at initialization.
Exceptions
InvalidArgumentExceptionif $text is neither a string or stream.