\Kaloa\ViewView

Basic view class.

Summary

Methods
Properties
Constants
__construct()
setEscapeFunction()
__set()
__get()
render()
escape()
clear()
No public properties found
No constants found
No protected methods found
$__vars
$__escapeFunction
N/A
No private methods found
No private properties found
N/A

Properties

$__vars

$__vars : array

Type

array — Variables set for this view.

$__escapeFunction

$__escapeFunction : \Closure

Type

\Closure — The function used by the escape method.

Methods

__construct()

__construct() 

Initializes the instance.

setEscapeFunction()

setEscapeFunction(\Closure  $escapeFunction) 

Sets the escape function used by the escape method.

Parameters

\Closure $escapeFunction

New escape function.

__set()

__set(string  $name, mixed  $value) 

Assigns a variable.

Parameters

string $name

Key to bind variable to.

mixed $value

Value for key.

__get()

__get(string  $name) : mixed

Returns the value of an assigned variable.

Parameters

string $name

Key to get value for.

Returns

mixed —

Value or null if not set.

render()

render(string  $template, array  $vars = array()) 

Renders a template file.

Parameters

string $template

Template file to render.

array $vars

Additional variables might be assigned.

escape()

escape(string  $string) : string

Escapes a string.

Parameters

string $string

String to escape.

Returns

string —

Escaped string.

clear()

clear() 

Removes all assigned variables.