PHP 클래스 LightnCandy\Compiler

상속: extends Validator
파일 보기 프로젝트 열기: zordius/lightncandy 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$lastParsed

공개 메소드들

메소드 설명
compileSubExpression ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : array Get string presentation of a sub expression
compileTemplate ( array\arraystring | integer> &$context, string $template ) : string | null Compile template into PHP code
composePHPRender ( array\arraystring | integer> $context, string $code ) : string Compose LightnCandy render codes for include()
inline ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string handle inline partial
partial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string handle partial

보호된 메소드들

메소드 설명
addUsageCount ( array\arraystring | integer> &$context, string $category, string $name, integer $count = 1 ) Add usage count to context
blockBegin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string Return compiled PHP code for a handlebars block begin token
blockCustomHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $inverted = false ) : string Return compiled PHP code for a handlebars block custom helper begin token
blockEnd ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, string | null $matchop = NULL ) : string Return compiled PHP code for a handlebars block end token
compileLog ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw ) : string Return compiled PHP code for a handlebars log token
compileLookup ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw, boolean $nosep = false ) : string Return compiled PHP code for a handlebars lookup token
compileOutput ( array\arraystring | integer> &$context, string $variable, string $expression, boolean $raw, boolean $nosep ) : string Return compiled PHP code for template output
compileToken ( array\arraystring | integer> &$context, array\array $info ) : string Return compiled PHP code for a handlebars token
compileVariable ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw, boolean $nosep ) : string Return compiled PHP code for a handlebars variable token
customHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $raw, boolean $nosep, boolean $subExp = false ) : string | null Return compiled PHP code for a handlebars custom helper token
doElse ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string Return compiled PHP code for a handlebars else token
getFuncName ( array\arraystring | integer> &$context, string $name, string $tag ) : string Get function name for standalone or none standalone template.
getVariableName ( arraystring | integer> &$context, arraystring | integer> $var, array | null $lookup = null, $args = null ) : array Get string presentation of a variable
getVariableNameOrSubExpression ( arraystring | integer> &$context, arraystring | integer> $var ) : array Get string presentation of a subexpression or a variable
getVariableNames ( array\arraystring | integer> &$context, array $vn, array | null $blockParams = null ) : array Get string presentation of variables
invertedSection ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string Return compiled PHP code for a handlebars inverted section begin token
section ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $isEach = false ) : string | null compile {{#foo}} token
with ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string | null compile {{with}} token

메소드 상세

addUsageCount() 보호된 정적인 메소드

Add usage count to context
protected static addUsageCount ( array\arraystring | integer> &$context, string $category, string $name, integer $count = 1 )
$context array\arraystring | integer>
$category string category name, can be one of: 'var', 'helpers', 'runtime'
$name string used name
$count integer increment

blockBegin() 보호된 정적인 메소드

Return compiled PHP code for a handlebars block begin token
protected static blockBegin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string Return compiled code segment for the token

blockCustomHelper() 보호된 정적인 메소드

Return compiled PHP code for a handlebars block custom helper begin token
protected static blockCustomHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $inverted = false ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$inverted boolean the logic will be inverted
리턴 string Return compiled code segment for the token

blockEnd() 보호된 정적인 메소드

Return compiled PHP code for a handlebars block end token
protected static blockEnd ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, string | null $matchop = NULL ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$matchop string | null should also match to this operator
리턴 string Return compiled code segment for the token

compileLog() 보호된 정적인 메소드

Return compiled PHP code for a handlebars log token
protected static compileLog ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$raw boolean is this {{{ token or not
리턴 string Return compiled code segment for the token

compileLookup() 보호된 정적인 메소드

Return compiled PHP code for a handlebars lookup token
protected static compileLookup ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw, boolean $nosep = false ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$raw boolean is this {{{ token or not
$nosep boolean true to compile without seperator
리턴 string Return compiled code segment for the token

compileOutput() 보호된 정적인 메소드

Return compiled PHP code for template output
protected static compileOutput ( array\arraystring | integer> &$context, string $variable, string $expression, boolean $raw, boolean $nosep ) : string
$context array\arraystring | integer>
$variable string PHP code for the variable
$expression string normalized handlebars expression
$raw boolean is this {{{ token or not
$nosep boolean true to compile without seperator
리턴 string Return compiled code segment for the token

compileSubExpression() 공개 정적인 메소드

Get string presentation of a sub expression
public static compileSubExpression ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : array
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 array

compileTemplate() 공개 정적인 메소드

Compile template into PHP code
public static compileTemplate ( array\arraystring | integer> &$context, string $template ) : string | null
$context array\arraystring | integer>
$template string handlebars template
리턴 string | null generated PHP code

compileToken() 보호된 정적인 메소드

Return compiled PHP code for a handlebars token
protected static compileToken ( array\arraystring | integer> &$context, array\array $info ) : string
$context array\arraystring | integer>
$info array\array
리턴 string Return compiled code segment for the token

compileVariable() 보호된 정적인 메소드

Return compiled PHP code for a handlebars variable token
protected static compileVariable ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, boolean $raw, boolean $nosep ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$raw boolean is this {{{ token or not
$nosep boolean true to compile without seperator
리턴 string Return compiled code segment for the token

composePHPRender() 공개 정적인 메소드

Compose LightnCandy render codes for include()
public static composePHPRender ( array\arraystring | integer> $context, string $code ) : string
$context array\arraystring | integer>
$code string generated PHP code
리턴 string Composed PHP code

customHelper() 보호된 정적인 메소드

Return compiled PHP code for a handlebars custom helper token
protected static customHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $raw, boolean $nosep, boolean $subExp = false ) : string | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$raw boolean is this {{{ token or not
$nosep boolean true to compile without seperator
$subExp boolean true when compile for subexpression
리턴 string | null Return compiled code segment for the token when the token is custom helper

doElse() 보호된 정적인 메소드

Return compiled PHP code for a handlebars else token
protected static doElse ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string Return compiled code segment for the token when the token is else

getFuncName() 보호된 정적인 메소드

Get function name for standalone or none standalone template.
protected static getFuncName ( array\arraystring | integer> &$context, string $name, string $tag ) : string
$context array\arraystring | integer>
$name string base function name
$tag string original handlabars tag for debug
리턴 string compiled Function name

getVariableName() 보호된 정적인 메소드

Get string presentation of a variable
protected static getVariableName ( arraystring | integer> &$context, arraystring | integer> $var, array | null $lookup = null, $args = null ) : array
$context arraystring | integer>
$var arraystring | integer>
$lookup array | null
리턴 array

getVariableNameOrSubExpression() 보호된 정적인 메소드

Get string presentation of a subexpression or a variable
protected static getVariableNameOrSubExpression ( arraystring | integer> &$context, arraystring | integer> $var ) : array
$context arraystring | integer>
$var arraystring | integer>
리턴 array

getVariableNames() 보호된 정적인 메소드

Get string presentation of variables
protected static getVariableNames ( array\arraystring | integer> &$context, array $vn, array | null $blockParams = null ) : array
$context array\arraystring | integer>
$vn array
$blockParams array | null
리턴 array

inline() 공개 정적인 메소드

handle inline partial
public static inline ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string Return compiled code segment for the partial

invertedSection() 보호된 정적인 메소드

Return compiled PHP code for a handlebars inverted section begin token
protected static invertedSection ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string Return compiled code segment for the token

partial() 공개 정적인 메소드

handle partial
public static partial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string Return compiled code segment for the partial

section() 보호된 정적인 메소드

compile {{#foo}} token
protected static section ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $isEach = false ) : string | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$isEach boolean the section is #each
리턴 string | null Return compiled code segment for the token

with() 보호된 정적인 메소드

compile {{with}} token
protected static with ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : string | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 string | null Return compiled code segment for the token

프로퍼티 상세

$lastParsed 공개적으로 정적으로 프로퍼티

public static $lastParsed