class Compiler

Latte compiler.

Traits

Better OOP experience.

Constants

CONTENT_HTML

Context-aware escaping content types

CONTENT_XHTML

Context-aware escaping content types

CONTENT_XML

Context-aware escaping content types

CONTENT_JS

Context-aware escaping content types

CONTENT_CSS

Context-aware escaping content types

CONTENT_ICAL

Context-aware escaping content types

CONTENT_TEXT

Context-aware escaping content types

CONTEXT_HTML_TEXT

CONTEXT_HTML_TAG

CONTEXT_HTML_ATTRIBUTE

CONTEXT_HTML_ATTRIBUTE_JS

CONTEXT_HTML_ATTRIBUTE_CSS

CONTEXT_HTML_ATTRIBUTE_URL

CONTEXT_HTML_ATTRIBUTE_UNQUOTED_URL

CONTEXT_HTML_COMMENT

CONTEXT_HTML_BOGUS_COMMENT

CONTEXT_HTML_CSS

CONTEXT_HTML_JS

CONTEXT_XML_TEXT

CONTEXT_XML_TAG

CONTEXT_XML_ATTRIBUTE

CONTEXT_XML_COMMENT

CONTEXT_XML_BOGUS_COMMENT

Methods

addMacro(string $name, IMacro $macro, int $flags = null)

Adds new macro with IMacro flags.

string
compile(array $tokens, string $className)

Compiles tokens to PHP code.

setContentType(string $type)

No description

MacroNode|null
getMacroNode()

No description

int|null
getLine()

Returns current line number.

bool
isInHead()

No description

void
addMethod(string $name, string $body, string $arguments = '')

Adds custom method to template.

array
getMethods()

Returns custom methods.

void
addProperty(string $name, $value)

Adds custom property to template.

array
getProperties()

Returns custom properites.

string
expandTokens(string $s)

No description

openMacro(string $name, string $args = null, string $modifiers = null, bool $isRightmost = false, string $nPrefix = null)

Generates code for {macro .

closeMacro(string $name, string $args = null, string $modifiers = null, bool $isRightmost = false, string $nPrefix = null)

Generates code for {/macro .

void
writeAttrsMacro(string $html)

Generates code for macro to the output.

expandMacro(string $name, string $args, string $modifiers = null, string $nPrefix = null)

Expands macro and returns node & code.

Details

at line 100
Compiler addMacro(string $name, IMacro $macro, int $flags = null)

Adds new macro with IMacro flags.

Parameters

string $name
IMacro $macro
int $flags

Return Value

Compiler

at line 116
string compile(array $tokens, string $className)

Compiles tokens to PHP code.

Parameters

array $tokens
string $className

Return Value

string

at line 194
Compiler setContentType(string $type)

Parameters

string $type

Return Value

Compiler

at line 202
MacroNode|null getMacroNode()

Return Value

MacroNode|null

at line 211
int|null getLine()

Returns current line number.

Return Value

int|null

at line 217
bool isInHead()

Return Value

bool

at line 227
void addMethod(string $name, string $body, string $arguments = '')

Adds custom method to template.

Parameters

string $name
string $body
string $arguments

Return Value

void

at line 237
array getMethods()

Returns custom methods.

Return Value

array

at line 247
void addProperty(string $name, $value)

Adds custom property to template.

Parameters

string $name
$value

Return Value

void

at line 257
array getProperties()

Returns custom properites.

Return Value

array

at line 264
string expandTokens(string $s)

Parameters

string $s

Return Value

string

at line 477
MacroNode openMacro(string $name, string $args = null, string $modifiers = null, bool $isRightmost = false, string $nPrefix = null)

Generates code for {macro .

..} to the output.

Parameters

string $name
string $args
string $modifiers
bool $isRightmost
string $nPrefix

Return Value

MacroNode

at line 499
MacroNode closeMacro(string $name, string $args = null, string $modifiers = null, bool $isRightmost = false, string $nPrefix = null)

Generates code for {/macro .

..} to the output.

Parameters

string $name
string $args
string $modifiers
bool $isRightmost
string $nPrefix

Return Value

MacroNode

at line 572
void writeAttrsMacro(string $html)

Generates code for macro to the output.

Parameters

string $html

Return Value

void

at line 678
MacroNode expandMacro(string $name, string $args, string $modifiers = null, string $nPrefix = null)

Expands macro and returns node & code.

Parameters

string $name
string $args
string $modifiers
string $nPrefix

Return Value

MacroNode