PHP Class Latte\Compiler

Inheritance: extends latte\Object
显示文件 Open project: nette/latte Class Usage Examples

Public Methods

Method Description
addMacro ( $name, latte\IMacro $macro, $flags = NULL ) : static Adds new macro with IMacro flags.
addMethod ( $name, $body, $arguments = '' ) : void Adds custom method to template.
addProperty ( $name, $value ) : void Adds custom property to template.
closeMacro ( $name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL ) : MacroNode Generates code for {/macro .
compile ( array $tokens, $className ) : string Compiles tokens to PHP code.
expandMacro ( $name, $args, $modifiers = NULL, $nPrefix = NULL ) : MacroNode Expands macro and returns node & code.
expandTokens ( $s )
getContentType ( )
getContext ( )
getLine ( ) : integer Returns current line number.
getMacroNode ( ) : MacroNode | null
getMethods ( ) : array Returns custom methods.
getProperties ( ) : array Returns custom properites.
isInHead ( ) : boolean
openMacro ( $name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL ) : MacroNode Generates code for {macro .
setContentType ( $type ) : static
setContext ( $context )
writeAttrsMacro ( $html ) : void Generates code for macro to the output.

Private Methods

Method Description
escape ( $s )
printEndTag ( $node )
processComment ( latte\Token $token )
processHtmlAttributeBegin ( latte\Token $token )
processHtmlAttributeEnd ( latte\Token $token )
processHtmlTagBegin ( latte\Token $token )
processHtmlTagEnd ( latte\Token $token )
processMacroTag ( latte\Token $token )
processText ( latte\Token $token )
writeCode ( $code, $isReplaced, $isRightmost )

Method Details

addMacro() public method

Adds new macro with IMacro flags.
public addMacro ( $name, latte\IMacro $macro, $flags = NULL ) : static
$macro latte\IMacro
return static

addMethod() public method

Adds custom method to template.
public addMethod ( $name, $body, $arguments = '' ) : void
return void

addProperty() public method

Adds custom property to template.
public addProperty ( $name, $value ) : void
return void

closeMacro() public method

..} to the output.
public closeMacro ( $name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL ) : MacroNode
return MacroNode

compile() public method

Compiles tokens to PHP code.
public compile ( array $tokens, $className ) : string
$tokens array
return string

expandMacro() public method

Expands macro and returns node & code.
public expandMacro ( $name, $args, $modifiers = NULL, $nPrefix = NULL ) : MacroNode
return MacroNode

expandTokens() public method

public expandTokens ( $s )

getContentType() public method

Deprecation:
public getContentType ( )

getContext() public method

Deprecation:
public getContext ( )

getLine() public method

Returns current line number.
public getLine ( ) : integer
return integer

getMacroNode() public method

public getMacroNode ( ) : MacroNode | null
return MacroNode | null

getMethods() public method

Returns custom methods.
public getMethods ( ) : array
return array

getProperties() public method

Returns custom properites.
public getProperties ( ) : array
return array

isInHead() public method

public isInHead ( ) : boolean
return boolean

openMacro() public method

..} to the output.
public openMacro ( $name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL ) : MacroNode
return MacroNode

setContentType() public method

public setContentType ( $type ) : static
return static

setContext() public method

public setContext ( $context )

writeAttrsMacro() public method

Generates code for macro to the output.
public writeAttrsMacro ( $html ) : void
return void