class Engine

Templating engine Latte.

Traits

Better OOP experience.

Constants

VERSION

CONTENT_HTML

Content types

CONTENT_XHTML

Content types

CONTENT_XML

Content types

CONTENT_JS

Content types

CONTENT_CSS

Content types

CONTENT_ICAL

Content types

CONTENT_TEXT

Content types

Properties

callable[] $onCompile

Methods

__construct()

No description

void
render(string $name, array $params = [], string $block = null)

Renders template to output.

string
renderToString(string $name, array $params = [], string $block = null)

Renders template to string.

createTemplate(string $name, array $params = [])

Creates template object.

string
compile(string $name)

Compiles template to PHP code.

void
warmupCache(string $name)

Compiles template to cache.

string
getCacheFile(string $name)

No description

string
getTemplateClass(string $name)

No description

addFilter(string|null $name, callable $callback)

Registers run-time filter.

array
getFilters()

Returns all run-time filters.

mixed
invokeFilter(string $name, array $args)

Call a run-time filter.

addMacro(string $name, IMacro $macro)

Adds new macro.

addProvider(string $name, $value)

Adds new provider.

array
getProviders()

Returns all providers.

setContentType(string $type)

No description

setTempDirectory(string $path)

Sets path to temporary directory.

setAutoRefresh(bool $on = true)

Sets auto-refresh mode.

setStrictTypes(bool $on = true)

Enables declare(strict_types=1) in templates.

getParser()

No description

getCompiler()

No description

setLoader(ILoader $loader)

No description

getLoader()

No description

Details

at line 63
__construct()

at line 72
void render(string $name, array $params = [], string $block = null)

Renders template to output.

Parameters

string $name
array $params
string $block

Return Value

void

at line 82
string renderToString(string $name, array $params = [], string $block = null)

Renders template to string.

Parameters

string $name
array $params
string $block

Return Value

string

at line 92
Template createTemplate(string $name, array $params = [])

Creates template object.

Parameters

string $name
array $params

Return Value

Template

at line 105
string compile(string $name)

Compiles template to PHP code.

Parameters

string $name

Return Value

string

at line 144
void warmupCache(string $name)

Compiles template to cache.

Parameters

string $name

Return Value

void

Exceptions

LogicException

at line 211
string getCacheFile(string $name)

Parameters

string $name

Return Value

string

at line 221
string getTemplateClass(string $name)

Parameters

string $name

Return Value

string

at line 232
Engine addFilter(string|null $name, callable $callback)

Registers run-time filter.

Parameters

string|null $name
callable $callback

Return Value

Engine

at line 243
array getFilters()

Returns all run-time filters.

Return Value

array

at line 253
mixed invokeFilter(string $name, array $args)

Call a run-time filter.

Parameters

string $name
array $args

Return Value

mixed

at line 263
Engine addMacro(string $name, IMacro $macro)

Adds new macro.

Parameters

string $name
IMacro $macro

Return Value

Engine

at line 274
Engine addProvider(string $name, $value)

Adds new provider.

Parameters

string $name
$value

Return Value

Engine

at line 284
array getProviders()

Returns all providers.

Return Value

array

at line 293
Engine setContentType(string $type)

Parameters

string $type

Return Value

Engine

at line 304
Engine setTempDirectory(string $path)

Sets path to temporary directory.

Parameters

string $path

Return Value

Engine

at line 315
Engine setAutoRefresh(bool $on = true)

Sets auto-refresh mode.

Parameters

bool $on

Return Value

Engine

at line 326
Engine setStrictTypes(bool $on = true)

Enables declare(strict_types=1) in templates.

Parameters

bool $on

Return Value

Engine

at line 333
Parser getParser()

Return Value

Parser

at line 342
Compiler getCompiler()

Return Value

Compiler

at line 356
Engine setLoader(ILoader $loader)

Parameters

ILoader $loader

Return Value

Engine

at line 363
ILoader getLoader()

Return Value

ILoader