\ApiJsonResponseProvider

ApiJsonResponseProvider implements a response provider based on ApiResponseProvider

ApiJsonResponseProvider provides end user data in json format.

Summary

Methods
Properties
Constants
sendData()
accessDenied()
No public properties found
MODE_JSON
MODE_XML
_getStatusCodeMessage()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

MODE_JSON

MODE_JSON

MODE_XML

MODE_XML

Methods

sendData()

sendData(array $data, int $status, array $headers)

Function converts $data array to appropriate format, sends it to client and terminates the application.

Usage example:

  $this->sendData(
      array(...),
      200,
      array(
          "Content-Range: items $offset-$limit/$total",
          ...
      )
  );

Parameters

array $data
int $status

code.

array $headers

http headers array.

accessDenied()

accessDenied() : null

Function displays "access denied" message to end users with 403 http status code and terminates the application.

Returns

null

_getStatusCodeMessage()

_getStatusCodeMessage(int $status) : string

Funcion return HTTP status code message

Parameters

int $status

status code

Returns

string —

code message