Methods summary
public static
|
#
verify( array<string,array|string|integer> & $context, string $template )
Verify template
Parameters
- $context
- Current context
- $template
- handlebars template
|
protected static
|
#
pushLeft( array<string,array|string|integer> & $context )
push left string of current token and clear it
push left string of current token and clear it
Parameters
|
protected static
|
#
pushPartial( array<string,array|string|integer> & $context, string $append )
push a string into the partial stacks
push a string into the partial stacks
Parameters
- $context
- Current context
- $append
- a string to be appended int partial stacks
|
protected static
|
#
pushToken( array<string,array|string|integer> & $context, string|array $token )
push a token into the stack when it is not empty string
push a token into the stack when it is not empty string
Parameters
- $context
- Current context
- $token
- a parsed token or a string
|
protected static
|
#
pushStack( array<string,array|string|integer> & $context, string $operation, array<boolean|integer|string|array> $vars )
push current token into the section stack
push current token into the section stack
Parameters
- $context
- Current context
- $operation
- operation string
- $vars
- parsed arguments list
|
protected static
boolean|null
|
#
delimiter( string[] $token, array<string,array|string|integer> & $context )
Verify delimiters and operators
Verify delimiters and operators
Parameters
- $token
- detected handlebars {{ }} token
- $context
- current compile context
Returns
boolean|null Return true when invalid
Expect
null when input array_fill(0, 11, ''), array()
null when input array(0, 0, 0, 0, 0, '{{', '#', '...', '}}'), array()
true when input array(0, 0, 0, 0, 0, '{', '#', '...', '}'), array()
|
protected static
boolean|integer|null
|
#
operator( string $operator, array<string,array|string|integer> & $context, array<boolean|integer|string|array> & $vars )
Verify operators
Parameters
- $operator
- the operator string
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|integer|null Return true when invalid or detected
Expect
null when input '', array(), array()
2 when input '^', array('usedFeature' => array('isec' => 1), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'elselvl' => array(), 'flags' => array('spvar' => 0), 'elsechain' => false, 'helperresolver' => 0), array(array('foo'))
true when input '/', array('stack' => array('[with]', '#'), 'level' => 1, 'currentToken' => array(0,0,0,0,0,0,0,'with'), 'flags' => array('nohbh' => 0)), array(array())
4 when input '#', array('usedFeature' => array('sec' => 3), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0), 'elsechain' => false, 'elselvl' => array(), 'helperresolver' => 0), array(array('x'))
5 when input '#', array('usedFeature' => array('if' => 4), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0, 'nohbh' => 0), 'elsechain' => false, 'elselvl' => array(), 'helperresolver' => 0), array(array('if'))
6 when input '#', array('usedFeature' => array('with' => 5), 'level' => 0, 'flags' => array('nohbh' => 0, 'runpart' => 0, 'spvar' => 0), 'currentToken' => array(0,0,0,0,0,0,0,0), 'elsechain' => false, 'elselvl' => array(), 'helperresolver' => 0), array(array('with'))
7 when input '#', array('usedFeature' => array('each' => 6), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0, 'nohbh' => 0), 'elsechain' => false, 'elselvl' => array(), 'helperresolver' => 0), array(array('each'))
8 when input '#', array('usedFeature' => array('unless' => 7), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0, 'nohbh' => 0), 'elsechain' => false, 'elselvl' => array(), 'helperresolver' => 0), array(array('unless'))
9 when input '#', array('helpers' => array('abc' => ''), 'usedFeature' => array('helper' => 8), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0), 'elsechain' => false, 'elselvl' => array()), array(array('abc'))
11 when input '#', array('helpers' => array('abc' => ''), 'usedFeature' => array('helper' => 10), 'level' => 0, 'currentToken' => array(0,0,0,0,0,0,0,0), 'flags' => array('spvar' => 0), 'elsechain' => false, 'elselvl' => array()), array(array('abc'))
true when input '>', array('partialresolver' => false, 'usedFeature' => array('partial' => 7), 'level' => 0, 'flags' => array('skippartial' => 0, 'runpart' => 0, 'spvar' => 0), 'currentToken' => array(0,0,0,0,0,0,0,0), 'elsechain' => false, 'elselvl' => array()), array('test')
|
protected static
boolean|null
|
#
inlinePartial( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate inline partial begin token
validate inline partial begin token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|null Return true when inline partial ends
|
protected static
boolean|null
|
#
partialBlock( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate partial block token
validate partial block token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|null Return true when partial block ends
|
protected static
|
#
doElseChain( array<string,array|string|integer> & $context )
handle else chain
Parameters
- $context
- current compile context
|
protected static
boolean
|
#
blockBegin( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate block begin token
validate block begin token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean Return true always
|
protected static
|
#
builtin( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate builtin helpers
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
|
protected static
boolean
|
#
section( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars, boolean $isEach = false )
validate section token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
- $isEach
- the section is #each
Returns
boolean Return true always
|
protected static
boolean
|
#
with( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate with token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean Return true always
|
protected static
boolean
|
#
unless( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate unless token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean Return true always
|
protected static
boolean
|
#
doIf( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate if token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean Return true always
|
protected static
integer|null
|
#
blockCustomHelper( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars, boolean $inverted = false )
validate block custom helper token
validate block custom helper token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
- $inverted
- the logic will be inverted
Returns
integer|null Return number of used custom helpers
|
protected static
integer
|
#
invertedSection( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate inverted section
validate inverted section
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
integer Return number of inverted sections
|
protected static
boolean|integer
|
#
blockEnd( array<string,array|string|integer> & $context, array<boolean|integer|string|array> & $vars, string|null $match = null )
Return compiled PHP code for a handlebars block end token
Return compiled PHP code for a handlebars block end token
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
- $match
- should also match to this operator
Returns
boolean|integer Return true when required block ended, or Token::POS_BACKFILL when backfill happened.
|
protected static
boolean|null
|
#
isDelimiter( array<string,array|string|integer> & $context )
handle delimiter change
Parameters
- $context
- current compile context
Returns
boolean|null Return true when delimiter changed
|
protected static
boolean|null
|
#
rawblock( string[] & $token, array<string,array|string|integer> & $context )
handle raw block
Parameters
- $token
- detected handlebars {{ }} token
- $context
- current compile context
Returns
boolean|null Return true when in rawblock mode
|
protected static
string|array<string,array|string|integer>|null
|
#
token( string[] & $token, array<string,array|string|integer> & $context )
Collect handlebars usage information, detect template error.
Collect handlebars usage information, detect template error.
Parameters
- $token
- detected handlebars {{ }} token
- $context
- current compile context
Returns
string|array<string,array|string|integer>|null $token string when rawblock; array when valid token require to be compiled, null when skip the token.
|
protected static
integer
|
#
doElse( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
Return 1 or larger number when else token detected
Return 1 or larger number when else token detected
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
integer Return 1 or larger number when else token detected
|
public static
boolean|null
|
#
log( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
Return true when this is {{log ...}}
Return true when this is {{log ...}}
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|null Return true when it is custom helper
|
public static
boolean|null
|
#
lookup( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
Return true when this is {{lookup ...}}
Return true when this is {{lookup ...}}
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|null Return true when it is custom helper
|
public static
boolean
|
#
helper( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars, boolean $checkSubexp = false )
Return true when the name is listed in helper table
Return true when the name is listed in helper table
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
- $checkSubexp
- true when check for subexpression
Returns
boolean Return true when it is custom helper
|
public static
boolean
|
#
resolveHelper( array<string,array|string|integer> & $context, array<boolean|integer|string|array> & $vars )
use helperresolver to resolve helper, return true when helper founded
use helperresolver to resolve helper, return true when helper founded
Parameters
- $context
- Current context of compiler progress.
- $vars
- parsed arguments list
Returns
boolean $found helper exists or not
|
protected static
boolean|null
|
#
isBlockHelper( array<string,array|string|integer> $context, array<boolean|integer|string|array> $vars )
detect for block custom helper
detect for block custom helper
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean|null Return true when this token is block custom helper
|
protected static
boolean
|
#
inline( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate inline partial
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
boolean Return true always
|
protected static
integer|boolean
|
#
partial( array<string,array|string|integer> & $context, array<boolean|integer|string|array> $vars )
validate partial
Parameters
- $context
- current compile context
- $vars
- parsed arguments list
Returns
integer|boolean Return 1 or larger number for runtime partial, return true for other case
|
protected static
string|null
|
#
spacing( array<string> & $token, array<string,array|string|integer> & $context, boolean $nost = false )
Modify $token when spacing rules matched.
Modify $token when spacing rules matched.
Parameters
- $token
- detected handlebars {{ }} token
- $context
- current compile context
- $nost
- do not do stand alone logic
Returns
string|null Return compiled code segment for the token
|