Skip to content

Latest commit

 

History

History
900 lines (440 loc) · 21.1 KB

class.WebserviceOutputBuilderCore.md

File metadata and controls

900 lines (440 loc) · 21.1 KB

Class WebserviceOutputBuilderCore

Contents

Constants

Properties

Methods

Constants

VIEW_DETAILS

const VIEW_DETAILS = 2

VIEW_LIST

const VIEW_LIST = 1

Properties

$depth

protected mixed $depth

$fieldsToDisplay

protected mixed $fieldsToDisplay

$headerParams

protected mixed $headerParams = array('Access-Time' => 0, 'X-Powered-By' => 0, 'PSWS-Version' => 0, 'Content-Type' => 0)

$objectRender

public mixed $objectRender

$output

protected mixed $output

$schemaToDisplay

protected mixed $schemaToDisplay

$specificFields

protected mixed $specificFields = array()

$status

protected string $status

$statusInt

protected mixed $statusInt

$virtualFields

protected mixed $virtualFields = array()

$wsParamOverrides

protected mixed $wsParamOverrides

$wsResource

protected mixed $wsResource

$wsUrl

protected mixed $wsUrl

Methods

__construct

mixed WebserviceOutputBuilderCore::__construct($ws_url)

Arguments

  • $ws_url mixed

addVirtualFields

mixed WebserviceOutputBuilderCore::addVirtualFields($entity_name, $entity_object)

Arguments

  • $entity_name mixed
  • $entity_object mixed

buildHeader

array WebserviceOutputBuilderCore::buildHeader()

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...)

getContent

string WebserviceOutputBuilderCore::getContent(array $objects, null|string $schema_to_display, string|array $fields_to_display, integer $depth, integer $type_of_view, $override)

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),

Arguments

  • $objects array - each object created by entity asked @see WebserviceOutputBuilder::executeEntityGetAndHead
  • $schema_to_display null|string - if null display the entities list or entity details.
  • $fields_to_display string|array - the fields allow for the output
  • $depth integer - depth for the tree diagram output.
  • $type_of_view integer - use the 2 constants WebserviceOutputBuilder::VIEW_LIST WebserviceOutputBuilder::VIEW_DETAILS
  • $override mixed

getErrors

string WebserviceOutputBuilderCore::getErrors(array $errors)

Build errors output using an error array

Arguments

  • $errors array

getHeaderParams

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

Arguments

  • $key null|string - if null get all header params otherwise the params specified by the key

getObjectRender

\WebserviceOutputInterface WebserviceOutputBuilderCore::getObjectRender()

getter

getResourcesList

string WebserviceOutputBuilderCore::getResourcesList($key_permissions)

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

Arguments

  • $key_permissions mixed

getSpecificField

mixed WebserviceOutputBuilderCore::getSpecificField()

getStatus

string WebserviceOutputBuilderCore::getStatus()

getStatusInt

mixed WebserviceOutputBuilderCore::getStatusInt()

getSynopsisDetails

mixed WebserviceOutputBuilderCore::getSynopsisDetails($field)

Arguments

  • $field mixed

getVirtualFields

mixed WebserviceOutputBuilderCore::getVirtualFields()

overrideSpecificField

mixed WebserviceOutputBuilderCore::overrideSpecificField($entity_name, $field_name, $field, $entity_object, $ws_params)

Arguments

  • $entity_name mixed
  • $field_name mixed
  • $field mixed
  • $entity_object mixed
  • $ws_params mixed

registerOverrideWSParameters

mixed WebserviceOutputBuilderCore::registerOverrideWSParameters($wsrObject, $method)

Arguments

  • $wsrObject mixed
  • $method mixed

renderAssociations

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

Arguments

  • $object mixed
  • $depth mixed
  • $associations mixed
  • $ws_params mixed

renderEntity

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

Build the entity detail.

Arguments

  • $object ObjectModel - create by the entity
  • $depth integer - the depth for the tree diagram

renderEntityMinimum

string WebserviceOutputBuilderCore::renderEntityMinimum($object, $depth)

Create the tree diagram with no details

Arguments

  • $object mixed - create by the entity
  • $depth mixed - the depth for the tree diagram

renderField

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

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

Arguments

  • $object ObjectModel - create by the entity
  • $ws_params array - webserviceParams from the entity
  • $field_name string
  • $field array
  • $depth integer

renderFlatAssociation

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

Arguments

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

renderSchema

string WebserviceOutputBuilderCore::renderSchema($object, $ws_params)

Build a schema blank or synopsis

Arguments

  • $object mixed - create by the entity
  • $ws_params mixed - webserviceParams from the entity

resetHeaderParams

\WebserviceOutputBuilderCore WebserviceOutputBuilderCore::resetHeaderParams()

Delete all Header parameters previously set.

setFieldsToDisplay

mixed WebserviceOutputBuilderCore::setFieldsToDisplay($fields)

Arguments

  • $fields mixed

setHeaderParams

\WebserviceOutputBuilderCore WebserviceOutputBuilderCore::setHeaderParams($key, $value)

Arguments

  • $key mixed - The normalized key expected for an http response
  • $value mixed

setIndent

mixed WebserviceOutputBuilderCore::setIndent($depth)

Arguments

  • $depth mixed

setObjectRender

\WebserviceOutputBuilderCore WebserviceOutputBuilderCore::setObjectRender(\WebserviceOutputInterface $obj_render)

Set the render object for set the output format.

Set the Content-type for the http header.

Arguments

  • $obj_render WebserviceOutputInterface

setSpecificField

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

Arguments

  • $object string|object
  • $method string
  • $field_name mixed
  • $entity_name mixed

setStatus

void WebserviceOutputBuilderCore::setStatus(integer $num)

Set the return header status

Arguments

  • $num integer - the Http status code

setVirtualField

mixed WebserviceOutputBuilderCore::setVirtualField($object, $method, $entity_name, $parameters)

Arguments

  • $object mixed
  • $method mixed
  • $entity_name mixed
  • $parameters mixed

setWsResources

\WebserviceOutputBuilderCore WebserviceOutputBuilderCore::setWsResources(array $resources)

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

Arguments

  • $resources array

validateObjectAndMethod

mixed WebserviceOutputBuilderCore::validateObjectAndMethod($object, $method)

Arguments

  • $object mixed
  • $method mixed