Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
ResponseFormatter Class Reference

Base class for Formating Rest responses. More...

+ Inheritance diagram for ResponseFormatter:

Public Member Functions

 get ($objects, $pages=null)
 Returns a formated JSON response for an array of objects $objects.
 
 getDatas ($objects, &$classname=null)
 Returns an array of datas from an array of objects.
 
 getJSONDatas ($datas)
 
 cleanRestObject ($o, &$classname=null)
 Returns the array of attributes corresponding to an object $o.
 
 getOne ($object)
 Returns a formated JSON response for an object $object.
 
 format ($arrayResponse)
 Formats a response array.
 
 getModel ($controllerName)
 Returns the model name corresponding to $controlleName.
 
 toJson ($data)
 Formats an array of datas in JSON.
 
 formatException ($e)
 Returns a JSON representation of the exception $e.
 

Static Public Member Functions

static toXML ($data, &$xml_data)
 

Detailed Description

Base class for Formating Rest responses.

Ubiquity\controllers\rest$ResponseFormatter This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.1.1

Definition at line 17 of file ResponseFormatter.php.

Member Function Documentation

◆ cleanRestObject()

cleanRestObject (   $o,
$classname = null 
)

Returns the array of attributes corresponding to an object $o.

Parameters
object$o
string$classname
Returns
array

Reimplemented in JsonApiResponseFormatter.

Definition at line 56 of file ResponseFormatter.php.

◆ format()

format (   $arrayResponse)

Formats a response array.

Parameters
array$arrayResponse
Returns
string

Definition at line 89 of file ResponseFormatter.php.

◆ formatException()

formatException (   $e)

Returns a JSON representation of the exception $e.

Parameters
\Exception$e
Returns
string

Definition at line 127 of file ResponseFormatter.php.

◆ get()

get (   $objects,
  $pages = null 
)

Returns a formated JSON response for an array of objects $objects.

Parameters
array$objects
array | null$pages
Returns
string

Reimplemented in JsonApiResponseFormatter.

Definition at line 26 of file ResponseFormatter.php.

◆ getDatas()

getDatas (   $objects,
$classname = null 
)

Returns an array of datas from an array of objects.

Parameters
array$objects
string$classname
Returns
array

Definition at line 38 of file ResponseFormatter.php.

◆ getJSONDatas()

getJSONDatas (   $datas)

Definition at line 45 of file ResponseFormatter.php.

◆ getModel()

getModel (   $controllerName)

Returns the model name corresponding to $controlleName.

Parameters
string$controllerName
Returns
string

Definition at line 102 of file ResponseFormatter.php.

◆ getOne()

getOne (   $object)

Returns a formated JSON response for an object $object.

Parameters
object$object
Returns
string

Reimplemented in JsonApiResponseFormatter.

Definition at line 79 of file ResponseFormatter.php.

◆ toJson()

toJson (   $data)

Formats an array of datas in JSON.

Parameters
array$data
Returns
string

Definition at line 117 of file ResponseFormatter.php.

◆ toXML()

static toXML (   $data,
$xml_data 
)
static

Definition at line 132 of file ResponseFormatter.php.


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