Copied!

Visitor

Visitor.php : 14

Visits a value object into an HTTP Response.

Properties

protected $generator

Visitor.php : 26

Generator.

protected Generator $generator

protected $response

Visitor.php : 33

HTTP Response Object.

protected Response $response

protected $valueObjectVisitorDispatcher

Visitor.php : 19
protected ValueObjectVisitorDispatcher $valueObjectVisitorDispatcher = []

Methods

public__construct()

Visitor.php : 48

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

public __construct(Generator $generator, ValueObjectVisitorDispatcher $valueObjectVisitorDispatcher)

Parameters

Name Type Default value Description
$generator Generator - -
$valueObjectVisitorDispatcher ValueObjectVisitorDispatcher - -

publicgetMediaType()

Visitor.php : 148

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

public getMediaType(string $type) : string

Parameters

Name Type Default value Description
$type string - -

Return values

string

publicgetResponse()

Visitor.php : 156
public getResponse() : Response

Return values

Response

publicsetHeader()

Visitor.php : 64

Set HTTP response header.

public setHeader(string $name, string $value) : mixed

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

Parameters

Name Type Default value Description
$name string - -
$value string - -

publicsetStatus()

Visitor.php : 78

Sets the given status code in the corresponding header.

public setStatus(int $statusCode) : mixed

Note that headers are generally not overwritten!

Parameters

Name Type Default value Description
$statusCode int - -

publicvisit()

Visitor.php : 93

Visit struct returned by controllers.

public visit(mixed $data) : Response

Parameters

Name Type Default value Description
$data mixed - -

Return values

Response

publicvisitValueObject()

Visitor.php : 131

Visit struct returned by controllers.

public visitValueObject(object $data) : mixed

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

Parameters

Name Type Default value Description
$data object - -