class SimpleTemplateView extends AbstractView (View source)

An abstract View

Traits

Properties

protected array $supportedOptions
protected array $options

The configuration options of this view

from  AbstractView
protected array $variables

View variables and their values

from  AbstractView
protected ControllerContext deprecated $controllerContext from  AbstractView

Methods

static ViewInterface
createWithOptions(array $options)

Factory method to create an instance with given options.

__construct(array $options = [])

Set default options based on the supportedOptions provided

mixed
getOption(string $optionName)

Get a specific option of this View

void
setOption(string $optionName, mixed $value)

Set a specific option of this View

assign(string $key, mixed $value)

Add a variable to $this->variables.

assignMultiple(array $values)

Add multiple variables to $this->variables.

void
setControllerContext(ControllerContext $controllerContext) deprecated

Sets the current controller context

StreamInterface
createStream(string $content = '')

No description

StreamInterface
createStreamFromFile(string $filename, string $mode = 'r')

No description

StreamInterface
createStreamFromResource($resource)

No description

StreamInterface
render()

Renders the view

Details

static ViewInterface createWithOptions(array $options)

Factory method to create an instance with given options.

Parameters

array $options

Return Value

ViewInterface

__construct(array $options = [])

Set default options based on the supportedOptions provided

Parameters

array $options

Exceptions

Exception

mixed getOption(string $optionName)

Get a specific option of this View

Parameters

string $optionName

Return Value

mixed

Exceptions

Exception

void setOption(string $optionName, mixed $value)

Set a specific option of this View

Parameters

string $optionName
mixed $value

Return Value

void

Exceptions

Exception

ViewInterface assign(string $key, mixed $value)

Add a variable to $this->variables.

Can be chained, so $this->view->assign(..., ...)->assign(..., ...); is possible

Parameters

string $key

Key of variable

mixed $value

Value of object

Return Value

ViewInterface

for chaining

ViewInterface assignMultiple(array $values)

Add multiple variables to $this->variables.

Parameters

array $values

associative array with the key being its name

Return Value

ViewInterface

for chaining

void setControllerContext(ControllerContext $controllerContext) deprecated

deprecated if you absolutely need access to the current request please assign a variable. when using the action controller the request is directly available at "request"

Sets the current controller context

Parameters

ControllerContext $controllerContext

Context of the controller associated with this view

Return Value

void

StreamInterface createStream(string $content = '')

No description

Parameters

string $content

Return Value

StreamInterface

StreamInterface createStreamFromFile(string $filename, string $mode = 'r')

No description

Parameters

string $filename
string $mode

Return Value

StreamInterface

StreamInterface createStreamFromResource($resource)

No description

Parameters

$resource

Return Value

StreamInterface

StreamInterface render()

Renders the view

Return Value

StreamInterface