Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
Response Class Reference
Inheritance diagram for Response:

Public Member Functions

 __construct ($body= '', $status=200, $headers=[])
 
 isSuccess ()
 
 finish ($content_renderer)
 
 output ()
 
 sendHeader ($header, $replace=FALSE, $status=NULL)
 
 reason ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 

Data Fields

 $body
 
 $status
 
 $headers
 

Detailed Description

Response class for the rest api

Author
mlunz.nosp@m.ena@.nosp@m.uos.d.nosp@m.e GPL 2 or later
Since
Stud.IP 3.0

Constructor & Destructor Documentation

__construct (   $body = '',
  $status = 200,
  $headers = [] 
)

Constructor, sets vital information if provided.

Parameters
String$bodyBody contents of the response, optional, defaults to empty string
int$statusHTTP status code, optional, defaults to 200
Array$headersHTTP headers, optional, defaults to no headers

Member Function Documentation

finish (   $content_renderer)

Finishes the response with the given response renderer.

Parameters
Renderer\DefaultRenderer$content_rendererUsed response renderer, only applied if body is not a callable closure
isSuccess ( )

Detects whether the response status is of success type (HTTP status 2xx)

Returns
bool True if status is of success type, false otherwise
offsetExists (   $offset)
offsetGet (   $offset)
offsetSet (   $offset,
  $value 
)
offsetUnset (   $offset)
output ( )

Sends the response.

reason ( )

Returns the reason phrase of this response according to RFC2616.

Returns
string the reason phrase for this response's status
sendHeader (   $header,
  $replace = FALSE,
  $status = NULL 
)

Internally used function to actually send headers

Parameters
stringthe HTTP header
booloptional; TRUE if previously sent header should be replaced - FALSE otherwise (default)
integeroptional; the HTTP response code
Returns
void

Field Documentation

$body
$headers
$status

The documentation for this class was generated from the following file: