Constants

VIEW_LIST

VIEW_LIST

VIEW_DETAILS

VIEW_DETAILS

Properties

$objectRender

$objectRender : 

Type

$wsUrl

$wsUrl : 

Type

$output

$output : 

Type

$wsResource

$wsResource : 

Type

$depth

$depth : 

Type

$schemaToDisplay

$schemaToDisplay : 

Type

$fieldsToDisplay

$fieldsToDisplay : 

Type

$specificFields

$specificFields : 

Type

$virtualFields

$virtualFields : 

Type

$statusInt

$statusInt : 

Type

$wsParamOverrides

$wsParamOverrides : 

Type

$_cache_ws_parameters

$_cache_ws_parameters : 

Type

$headerParams

$headerParams : 

Type

$status

$status : string

Type

string — Status header sent at return

Methods

__construct()

__construct(  $ws_url) 

Parameters

$ws_url

setObjectRender()

setObjectRender(\WebserviceOutputInterface  $obj_render) : $this

Set the render object for set the output format.

Set the Content-type for the http header.

Parameters

\WebserviceOutputInterface $obj_render

Throws

\WebserviceException

if the object render is not an instance of WebserviceOutputInterface

Returns

$this

setWsResources()

setWsResources(array  $resources) : $this

Need to have the resource list to get the class name for an entity, To build

Parameters

array $resources

Returns

$this

buildHeader()

buildHeader() : array

This method return an array with each http header params for a content.

This check each required params.

If this method is overrided don't forget to check required specific params (for xml etc...)

Returns

array

setHeaderParams()

setHeaderParams(string  $key, string  $value) : $this

Parameters

string $key

The normalized key expected for an http response

string $value

Throws

\WebserviceException

if the key or the value are corrupted (use Validate::isCleanHtml method)

Returns

$this

getHeaderParams()

getHeaderParams(null|string  $key = null) : array|string

Parameters

null|string $key

if null get all header params otherwise the params specified by the key

Throws

\WebserviceException

if the key is corrupted (use Validate::isCleanHtml method)

\WebserviceException

if the asked key does'nt exists.

Returns

array|string

resetHeaderParams()

resetHeaderParams() : $this

Delete all Header parameters previously set.

Returns

$this

getStatus()

getStatus() : string

Returns

string —

the normalized status for http request

getStatusInt()

getStatusInt() 

setStatus()

setStatus(integer  $num) : void

Set the return header status

Parameters

integer $num

the Http status code

getErrors()

getErrors(array  $errors) : string

Build errors output using an error array

Parameters

array $errors

Returns

string —

output in the format specified by WebserviceOutputBuilder::objectRender

getResourcesList()

getResourcesList(  $key_permissions) : string

Build the resource list in the output format specified by WebserviceOutputBuilder::objectRender

Parameters

$key_permissions

Returns

string

registerOverrideWSParameters()

registerOverrideWSParameters(  $wsrObject,   $method) 

Parameters

$wsrObject
$method

getContent()

getContent(array  $objects, null|string  $schema_to_display = null, string|array  $fields_to_display = 'minimum', integer  $depth, integer  $type_of_view = self::VIEW_LIST,   $override = true) : string

Method is used for each content type Different content types are : - list of entities, - tree diagram of entity details (full or minimum), - schema (synopsis & blank),

Parameters

array $objects

each object created by entity asked @see WebserviceOutputBuilder::executeEntityGetAndHead

null|string $schema_to_display

if null display the entities list or entity details.

string|array $fields_to_display

the fields allow for the output

integer $depth

depth for the tree diagram output.

integer $type_of_view

use the 2 constants WebserviceOutputBuilder::VIEW_LIST WebserviceOutputBuilder::VIEW_DETAILS

$override

Returns

string —

in the output format specified by WebserviceOutputBuilder::objectRender

renderEntityMinimum()

renderEntityMinimum(\ObjectModel  $object, integer  $depth) : string

Create the tree diagram with no details

Parameters

\ObjectModel $object

create by the entity

integer $depth

the depth for the tree diagram

Returns

string

renderEntity()

renderEntity(\ObjectModel  $object, integer  $depth) : string

Build the entity detail.

Parameters

\ObjectModel $object

create by the entity

integer $depth

the depth for the tree diagram

Returns

string

setIndent()

setIndent(  $depth) 

Parameters

$depth

getSynopsisDetails()

getSynopsisDetails(  $field) 

Parameters

$field

setSpecificField()

setSpecificField(string|object  $object, string  $method,   $field_name,   $entity_name) : $this

Parameters

string|object $object
string $method
$field_name
$entity_name

Returns

$this

getSpecificField()

getSpecificField() 

setVirtualField()

setVirtualField(  $object,   $method,   $entity_name,   $parameters) 

Parameters

$object
$method
$entity_name
$parameters

getVirtualFields()

getVirtualFields() 

addVirtualFields()

addVirtualFields(  $entity_name,   $entity_object) 

Parameters

$entity_name
$entity_object

setFieldsToDisplay()

setFieldsToDisplay(  $fields) 

Parameters

$fields

renderSchema()

renderSchema(\ObjectModel  $object, array  $ws_params) : string

Build a schema blank or synopsis

Parameters

\ObjectModel $object

create by the entity

array $ws_params

webserviceParams from the entity

Returns

string

renderField()

renderField(\ObjectModel  $object, array  $ws_params, string  $field_name, array  $field, integer  $depth) : string

Build a field and use recursivity depend on the depth parameter.

Parameters

\ObjectModel $object

create by the entity

array $ws_params

webserviceParams from the entity

string $field_name
array $field
integer $depth

Returns

string

renderAssociations()

renderAssociations(  $object,   $depth,   $associations,   $ws_params) : string

Parameters

$object
$depth
$associations
$ws_params

Returns

string

renderFlatAssociation()

renderFlatAssociation(  $object,   $depth,   $assoc_name,   $resource_name,   $fields_assoc,   $object_assoc,   $parent_details) 

Parameters

$object
$depth
$assoc_name
$resource_name
$fields_assoc
$object_assoc
$parent_details

validateObjectAndMethod()

validateObjectAndMethod(  $object,   $method) 

Parameters

$object
$method

overrideSpecificField()

overrideSpecificField(  $entity_name,   $field_name,   $field,   $entity_object,   $ws_params) 

Parameters

$entity_name
$field_name
$field
$entity_object
$ws_params