View
+ Inheritance diagram for View:

Description

Renders a template with data.

Protected Properties

int DateTimeInterface $cacheTtl = 0
 
array $data = []
 Extracted to variables upon render. More...
 
string $template
 

Public Methods

 __construct (string $template, array $data=[])
 
string __toString ()
 
int DateTimeInterface getCacheTtl ()
 The minimum TTL, considering the instance itself and any nested views. More...
 
string getContent ()
 Returns what would be rendered. More...
 
bool offsetExists ($offset)
 
mixed offsetGet ($key)
 
void offsetSet ($key, $value)
 
void offsetUnset ($key)
 
void render ()
 Directly outputs content. More...
 
$this setCacheTtl ($cacheTtl)
 

Properties

◆ $data

array $data = []
protected

Extracted to variables upon render.

Methods

◆ __toString()

string __toString ( )
Returns
string

◆ getCacheTtl()

int DateTimeInterface getCacheTtl ( )

The minimum TTL, considering the instance itself and any nested views.

Returns
int|DateTimeInterface

◆ getContent()

string getContent ( )

Returns what would be rendered.

Returns
string

◆ offsetExists()

bool offsetExists (   $offset)
Parameters
mixed$offset
Returns
bool

◆ offsetGet()

mixed offsetGet (   $key)
Parameters
mixed$key
Returns
mixed

◆ offsetSet()

void offsetSet (   $key,
  $value 
)
Parameters
mixed$key
mixed$value

◆ offsetUnset()

void offsetUnset (   $key)
Parameters
mixed$key

◆ render()

void render ( )

Directly outputs content.

Extracts $data to variables, and includes the template. $this within the template references the view instance.

◆ setCacheTtl()

$this setCacheTtl (   $cacheTtl)
Parameters
int | DateTimeInterface$cacheTtl
Returns
$this