Class

eZ\Publish\Core\REST\Common\Output\Visitor

class Visitor

Visits a value object into an HTTP Response.

Methods

__construct(Generator $generator, ValueObjectVisitorDispatcher $valueObjectVisitorDispatcher)

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

setHeader(string $name, string $value)

Set HTTP response header.

setStatus(int $statusCode)

Sets the given status code in the corresponding header.

Response visit(mixed $data)

Visit struct returned by controllers.

mixed visitValueObject(object $data)

Visit struct returned by controllers.

string getMediaType(string $type)

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

Response getResponse()

Details

at line 52
public __construct(Generator $generator, ValueObjectVisitorDispatcher $valueObjectVisitorDispatcher)

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

Parameters

Generator $generator
ValueObjectVisitorDispatcher $valueObjectVisitorDispatcher

at line 68
public setHeader(string $name, string $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

at line 82
public setStatus(int $statusCode)

Sets the given status code in the corresponding header.

Note that headers are generally not overwritten!

Parameters

int $statusCode

at line 97
public Response visit(mixed $data)

Visit struct returned by controllers.

Parameters

mixed $data

Return Value

Response

at line 135
public mixed visitValueObject(object $data)

Visit struct returned by controllers.

Can be called by sub-visitors to visit nested objects.

Parameters

object $data

Return Value

mixed

at line 152
public string getMediaType(string $type)

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

Parameters

string $type

Return Value

string

See also

\eZ\Publish\Core\REST\Common\Generator::getMediaType()

at line 160
public Response getResponse()

Return Value

Response