class Compiler

Latte compiler.

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

internal CONTEXT_HTML_TEXT

internal CONTEXT_HTML_TAG

internal CONTEXT_HTML_ATTRIBUTE

internal CONTEXT_HTML_ATTRIBUTE_JS

internal CONTEXT_HTML_ATTRIBUTE_CSS

internal CONTEXT_HTML_ATTRIBUTE_URL

internal CONTEXT_HTML_ATTRIBUTE_UNQUOTED_URL

internal CONTEXT_HTML_COMMENT

internal CONTEXT_HTML_BOGUS_COMMENT

internal CONTEXT_HTML_CSS

internal CONTEXT_HTML_JS

internal CONTEXT_XML_TEXT

internal CONTEXT_XML_TAG

internal CONTEXT_XML_ATTRIBUTE

internal CONTEXT_XML_COMMENT

internal CONTEXT_XML_BOGUS_COMMENT

Methods

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

Adds new macro with IMacro flags.

string
compile(array $tokens, $className)

Compiles tokens to PHP code.

setContentType($type)

No description

getContentType() deprecated

No description

setContext($context)

No description

getContext() deprecated

No description

MacroNode|null
getMacroNode()

No description

int|null
getLine()

Returns current line number.

bool
isInHead()

No description

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

Adds custom method to template.

array
getMethods()

Returns custom methods.

void
addProperty($name, $value)

Adds custom property to template.

array
getProperties()

Returns custom properites.

expandTokens($s)

No description

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

Generates code for {macro ...} to the output.

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

Generates code for {/macro ...} to the output.

void
writeAttrsMacro($html)

Generates code for macro to the output.

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

Expands macro and returns node & code.

Details

at line 99
Compiler addMacro($name, IMacro $macro, $flags = null)

Adds new macro with IMacro flags.

Parameters

$name
IMacro $macro
$flags

Return Value

Compiler

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

Compiles tokens to PHP code.

Parameters

array $tokens
$className

Return Value

string

at line 194
Compiler setContentType($type)

No description

Parameters

$type

Return Value

Compiler

at line 205
getContentType() deprecated

deprecated

No description

at line 215
setContext($context)

internal  
 

No description

Parameters

$context

at line 226
getContext() deprecated

deprecated

No description

at line 236
MacroNode|null getMacroNode()

No description

Return Value

MacroNode|null

at line 246
int|null getLine()

Returns current line number.

Return Value

int|null

at line 255
bool isInHead()

No description

Return Value

bool

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

internal  
 

Adds custom method to template.

Parameters

$name
$body
$arguments

Return Value

void

at line 277
array getMethods()

internal  
 

Returns custom methods.

Return Value

array

at line 288
void addProperty($name, $value)

internal  
 

Adds custom property to template.

Parameters

$name
$value

Return Value

void

at line 299
array getProperties()

internal  
 

Returns custom properites.

Return Value

array

at line 306
expandTokens($s)

internal  
 

No description

Parameters

$s

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

internal  
 

Generates code for {macro ...} to the output.

Parameters

$name
$args
$modifiers
$isRightmost
$nPrefix

Return Value

MacroNode

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

internal  
 

Generates code for {/macro ...} to the output.

Parameters

$name
$args
$modifiers
$isRightmost
$nPrefix

Return Value

MacroNode

at line 635
void writeAttrsMacro($html)

internal  
 

Generates code for macro to the output.

Parameters

$html

Return Value

void

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

internal  
 

Expands macro and returns node & code.

Parameters

$name
$args
$modifiers
$nPrefix

Return Value

MacroNode

Traits

Better OOP experience.