class PhpView implements ViewInterface (View source)

Render a view file with php.

Traits

Methods

string
getName()

Get name.

setName(string $name)

Set name.

mixed
getContext(string|null $key = null, mixed|null $default = null)

Get context values.

with(string|array $key, mixed $value = null)

Add context values.

__construct(PhpViewEngine $engine)

Constructor.

string
getFilepath()

Get filepath.

setFilepath(string $filepath)

Set filepath.

getLayout()

Get layout.

setLayout(ViewInterface|null $layout)

Set layout.

string
toString()

Render the view to a string.

ResponseInterface
toResponse()

Convert to Psr\Http\Message\ResponseInterface.

Details

string getName()

Get name.

Return Value

string

HasNameTrait setName(string $name)

Set name.

Parameters

string $name

Return Value

HasNameTrait $this

mixed getContext(string|null $key = null, mixed|null $default = null)

Get context values.

Parameters

string|null $key
mixed|null $default

Return Value

mixed

HasContextTrait with(string|array $key, mixed $value = null)

Add context values.

Parameters

string|array $key mixed> $key
mixed $value

Return Value

HasContextTrait $this

__construct(PhpViewEngine $engine)

Constructor.

Parameters

PhpViewEngine $engine

string getFilepath()

Get filepath.

Return Value

string

PhpView setFilepath(string $filepath)

Set filepath.

Parameters

string $filepath

Return Value

PhpView $this

ViewInterface|null getLayout()

Get layout.

Return Value

ViewInterface|null

PhpView setLayout(ViewInterface|null $layout)

Set layout.

Parameters

ViewInterface|null $layout

Return Value

PhpView $this

string toString()

Render the view to a string.

Return Value

string

ResponseInterface toResponse()

Convert to Psr\Http\Message\ResponseInterface.

Return Value

ResponseInterface