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

Properties

string[] $placeholders
string|null $paramsExtraction

Methods

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

Adds new macro with Macro flags.

setFunctions(array $names)

Registers run-time functions.

setFilters(array $names)

No description

string
compile(array $tokens, string $className, string|null $comment = null, bool $strictMode = false)

Compiles tokens to PHP file

setPolicy(Policy|null $policy)

No description

Policy|null
getPolicy()

No description

setContentType(string $type)

No description

string
getContentType()

No description

MacroNode|null
getMacroNode()

No description

array
getMacros()

No description

array
getFunctions()

No description

array
getFilters()

No description

int|null
getLine()

Returns current line number.

bool
isInHead()

No description

void
addMethod(string $name, string $body, string $arguments = '', string $returns = '', string|null $comment = null)

Adds custom method to template.

array
getMethods()

Returns custom methods.

void
addProperty(string $name, mixed $value)

Adds custom property to template.

array
getProperties()

Returns custom properites.

void
addConstant(string $name, mixed $value)

Adds custom constant to template.

string
expandTokens(string $s)

No description

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

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

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

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

void
writeAttrsMacro(string $html, bool|null $empty = null)

Generates code for macro to the output.

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

Expands macro and returns node & code.

Details

at line 115
Compiler addMacro(string $name, Macro $macro, int|null $flags = null)

Adds new macro with Macro flags.

Parameters

string $name
Macro $macro
int|null $flags

Return Value

Compiler

at line 137
Compiler setFunctions(array $names)

Registers run-time functions.

Parameters

array $names

Return Value

Compiler

at line 144
setFilters(array $names)

No description

Parameters

array $names

at line 155
string compile(array $tokens, string $className, string|null $comment = null, bool $strictMode = false)

Compiles tokens to PHP file

Parameters

array $tokens
string $className
string|null $comment
bool $strictMode

Return Value

string

at line 262
Compiler setPolicy(Policy|null $policy)

No description

Parameters

Policy|null $policy

Return Value

Compiler

at line 269
Policy|null getPolicy()

No description

Return Value

Policy|null

at line 276
Compiler setContentType(string $type)

No description

Parameters

string $type

Return Value

Compiler

at line 284
string getContentType()

No description

Return Value

string

at line 290
MacroNode|null getMacroNode()

No description

Return Value

MacroNode|null

at line 299
array getMacros()

No description

Return Value

array

at line 308
array getFunctions()

No description

Return Value

array

at line 317
array getFilters()

No description

Return Value

array

at line 326
int|null getLine()

Returns current line number.

Return Value

int|null

at line 334
bool isInHead()

No description

Return Value

bool

at line 344
void addMethod(string $name, string $body, string $arguments = '', string $returns = '', string|null $comment = null)

internal  
 

Adds custom method to template.

Parameters

string $name
string $body
string $arguments
string $returns
string|null $comment

Return Value

void

at line 362
array getMethods()

internal  
 

Returns custom methods.

Return Value

array

at line 373
void addProperty(string $name, mixed $value)

internal  
 

Adds custom property to template.

Parameters

string $name
mixed $value

Return Value

void

at line 384
array getProperties()

internal  
 

Returns custom properites.

Return Value

array

at line 395
void addConstant(string $name, mixed $value)

internal  
 

Adds custom constant to template.

Parameters

string $name
mixed $value

Return Value

void

at line 402
string expandTokens(string $s)

internal  
 

No description

Parameters

string $s

Return Value

string

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

internal  
 

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

Parameters

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

Return Value

MacroNode

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

internal  
 

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

Parameters

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

Return Value

MacroNode

at line 747
void writeAttrsMacro(string $html, bool|null $empty = null)

internal  
 

Generates code for macro to the output.

Parameters

string $html
bool|null $empty

Return Value

void

at line 864
MacroNode expandMacro(string $name, string $args, string $modifiers = '', string|null $nPrefix = null)

internal  
 

Expands macro and returns node & code.

Parameters

string $name
string $args
string $modifiers
string|null $nPrefix

Return Value

MacroNode

Traits

Better OOP experience.