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


Detailed Description

Response class for the rest api

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

Constructor & Destructor Documentation

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

Constructor, sets vital information if provided.

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.

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)

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

Sends the response.

reason ( )

Returns the reason phrase of this response according to RFC2616.

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

Internally used function to actually send headers

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

Field Documentation


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