eZPublishCommunityProject  2013.5
eZ\Publish\Core\REST\Common\Output\Visitor Class Reference

Visitor for view models. More...

Public Member Functions

 __construct (Generator $generator, array $visitors)
 Construct from Generator and an array of concrete view model visitors. More...
 
 addVisitor ($class, ValueObjectVisitor $visitor)
 Adds a new visitor for the given class. More...
 
 getMediaType ($type)
 Generates a media type for $type based on the used generator. More...
 
 setHeader ($name, $value)
 Set HTTP response header. More...
 
 setStatus ($statusCode)
 Sets the given status code in the corresponding header. More...
 
 visit ($data)
 Visit struct returned by controllers. More...
 
 visitValueObject ($data)
 Visit struct returned by controllers. More...
 

Static Public Attributes

static $statusMap
 

Protected Attributes

 $generator
 
 $headers = array()
 
 $visitors = array()
 

Detailed Description

Visitor for view models.

Constructor & Destructor Documentation

eZ\Publish\Core\REST\Common\Output\Visitor::__construct ( Generator  $generator,
array  $visitors 
)

Construct from Generator and an array of concrete view model visitors.

Parameters
\eZ\Publish\Core\REST\Common\Output\Generator$generator
array$visitors

Member Function Documentation

eZ\Publish\Core\REST\Common\Output\Visitor::addVisitor (   $class,
ValueObjectVisitor  $visitor 
)

Adds a new visitor for the given class.

Parameters
string$class
\eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor$visitor

Referenced by eZ\Publish\Core\REST\Common\Output\Visitor\__construct().

eZ\Publish\Core\REST\Common\Output\Visitor::getMediaType (   $type)

Generates a media type for $type based on the used generator.

Parameters
string$type
See Also
::getMediaType()
Returns
string
eZ\Publish\Core\REST\Common\Output\Visitor::setHeader (   $name,
  $value 
)

Set HTTP response header.

Does not allow overwriting of response headers. The first definition of a header will be used.

Parameters
string$name
string$value

Referenced by eZ\Publish\Core\REST\Common\Output\Visitor\setStatus(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\SeeOther\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedLocation\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedObjectState\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedObjectStateGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedPolicy\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContent\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedRelation\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedRole\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedSection\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedURLAlias\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContentType\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedURLWildcard\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedUser\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedUserGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedVersion\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContentTypeGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedFieldDefinition\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\SectionList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\SectionIncludingContentMetadataUpdateStruct\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\SectionCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Section\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserSession\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ContentObjectStates\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroupRefList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\LocationList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RoleList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\RoleAssignment\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\RoleUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Root\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ContentTypeCreateStruct\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ObjectStateCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestTrashItem\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\PolicyCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestObjectState\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ContentTypeGroupUpdateStruct\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ObjectStateGroupCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\VersionList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ObjectStateGroupUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ResourceCreated\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLWildcard\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLWildcardList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Policy\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ObjectStateUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\PermanentRedirect\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserRefList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\PolicyList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\PolicyUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserGroupRefList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\SectionUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Trash\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLAliasRefList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\RoleCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Role\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ContentTypeGroupCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentObjectStates\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestLocation\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLAliasList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\TemporaryRedirect\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RoleAssignmentList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\FieldDefinitionList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContentType\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLAlias\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUserGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUser\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUserRoleAssignment\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\LocationUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContent\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeInfoList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RelationList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\LocationCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUserGroupRoleAssignment\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestRelation\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\FieldDefinitionCreateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestFieldDefinition\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestExecutedView\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Version\visit(), and eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Exception\visit().

eZ\Publish\Core\REST\Common\Output\Visitor::setStatus (   $statusCode)

Sets the given status code in the corresponding header.

Note that headers are generally not overwritten!

Parameters
int$statusCode

Referenced by eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Conflict\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\SeeOther\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContentTypeGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedRole\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedObjectStateGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedUserGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedVersion\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedPolicy\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContent\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedRelation\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedUser\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedURLWildcard\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedURLAlias\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedSection\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedFieldDefinition\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedContentType\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedLocation\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedObjectState\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\PermanentRedirect\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\TemporaryRedirect\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserSession\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\NoContent\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ResourceCreated\visit(), and eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Exception\visit().

eZ\Publish\Core\REST\Common\Output\Visitor::visit (   $data)

Visit struct returned by controllers.

Parameters
mixed$data
Returns
eZ\Publish\Core\REST\Common\Output\Visitor::visitValueObject (   $data)

Visit struct returned by controllers.

Should be called from sub-visitors to visit nested objects.

Parameters
mixed$data

Referenced by eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\ContentTypeCreateStruct\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\PolicyCreateStruct\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\RoleAssignment\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\PolicyList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RoleList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\SectionList\visit(), eZ\Publish\Core\REST\Client\Output\ValueObjectVisitor\PolicyUpdateStruct\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Trash\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLAliasList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\URLWildcardList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\UserList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateGroupList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\VersionList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContentType\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUser\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestUserGroup\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RoleAssignmentList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\FieldDefinitionList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContent\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RelationList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeInfoList\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestExecutedView\visit(), eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\Version\visit(), and eZ\Publish\Core\REST\Common\Output\Visitor\visit().

Member Data Documentation

eZ\Publish\Core\REST\Common\Output\Visitor::$generator
protected
eZ\Publish\Core\REST\Common\Output\Visitor::$headers = array()
protected
eZ\Publish\Core\REST\Common\Output\Visitor::$statusMap
static
eZ\Publish\Core\REST\Common\Output\Visitor::$visitors = array()
protected

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