PHP 클래스 LightnCandy\Validator

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

공개 메소드들

메소드 설명
helper ( array\arraystring | integer> &$context, string $name, boolean $checkSubexp = false ) : boolean Return true when the name is listed in helper table
log ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null Return true when this is {{log .
lookup ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null Return true when this is {{lookup .
resolveHelper ( array\arraystring | integer> &$context, string &$name ) : string | null use helperresolver to resolve helper, return true when helper founded
verify ( array\arraystring | integer> &$context, string $template ) Verify template

보호된 메소드들

메소드 설명
blockBegin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean validate block begin token
blockCustomHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $inverted = false ) : integer | null validate block custom helper token
blockEnd ( array\arraystring | integer> &$context, arrayinteger | string | array> &$vars, string | null $match = null ) : boolean Return compiled PHP code for a handlebars block end token
builtin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) validate builtin helpers
comment ( string[] &$token, array\arraystring | integer> &$context ) : boolean | null handle comment
delimiter ( string[] $token, array\arraystring | integer> &$context ) : boolean | null Verify delimiters and operators
doElse ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer Return 1 or larger number when else token detected
doElseChain ( array\arraystring | integer> &$context ) handle else chain
doIf ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean validate if token
inline ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean validate inline partial
inlinePartial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null validate inline partial begin token
invertedSection ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer validate inverted section
isBlockHelper ( array\arraystring | integer> $context, arrayinteger | string | array> $vars ) : boolean | null detect for block custom helper
isDelimiter ( array\arraystring | integer> &$context ) : boolean | null handle delimiter change
operator ( string $operator, array\arraystring | integer> &$context, arrayinteger | string | array> &$vars ) : boolean | integer | null Verify operators
partial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer | boolean validate partial
partialBlock ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null validate partial block token
pushLeft ( array\arraystring | integer> &$context ) push left string of current token and clear it
pushStack ( array\arraystring | integer> &$context, string $operation, arrayinteger | string | array> $vars ) push current token into the section stack
pushToken ( array\arraystring | integer> &$context, string | array $token ) push a token into the stack when it is not empty string
rawblock ( string[] &$token, array\arraystring | integer> &$context ) : boolean | null handle raw block
section ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $isEach = false ) : boolean validate section token
spacing ( array &$token, array\arraystring | integer> &$context, boolean $nost = false ) : string | null Modify $token when spacing rules matched.
token ( string[] &$token, array\arraystring | integer> &$context ) Collect handlebars usage information, detect template error.
unless ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean validate unless token
with ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean validate with token

메소드 상세

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

validate block begin token
protected static blockBegin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean Return true always

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

validate block custom helper token
protected static blockCustomHelper ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $inverted = false ) : integer | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$inverted boolean the logic will be inverted
리턴 integer | null Return number of used custom helpers

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

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

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

validate builtin helpers
protected static builtin ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars )
$context array\arraystring | integer>
$vars arrayinteger | string | array>

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

handle comment
protected static comment ( string[] &$token, array\arraystring | integer> &$context ) : boolean | null
$token string[] detected handlebars {{ }} token
$context array\arraystring | integer>
리턴 boolean | null Return true when is comment

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

Verify delimiters and operators
protected static delimiter ( string[] $token, array\arraystring | integer> &$context ) : boolean | null
$token string[] detected handlebars {{ }} token
$context array\arraystring | integer>
리턴 boolean | null Return true when invalid

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

Return 1 or larger number when else token detected
protected static doElse ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 integer Return 1 or larger number when else token detected

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

handle else chain
protected static doElseChain ( array\arraystring | integer> &$context )
$context array\arraystring | integer>

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

validate if token
protected static doIf ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean Return true always

helper() 공개 정적인 메소드

Return true when the name is listed in helper table
public static helper ( array\arraystring | integer> &$context, string $name, boolean $checkSubexp = false ) : boolean
$context array\arraystring | integer>
$name string token name
$checkSubexp boolean true when check for subexpression
리턴 boolean Return true when it is custom helper

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

validate inline partial
protected static inline ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean Return true always

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

validate inline partial begin token
protected static inlinePartial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | null Return true when inline partial ends

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

validate inverted section
protected static invertedSection ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 integer Return number of inverted sections

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

detect for block custom helper
protected static isBlockHelper ( array\arraystring | integer> $context, arrayinteger | string | array> $vars ) : boolean | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | null Return true when this token is block custom helper

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

handle delimiter change
protected static isDelimiter ( array\arraystring | integer> &$context ) : boolean | null
$context array\arraystring | integer>
리턴 boolean | null Return true when delimiter changed

log() 공개 정적인 메소드

..}}
public static log ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | null Return true when it is custom helper

lookup() 공개 정적인 메소드

..}}
public static lookup ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | null Return true when it is custom helper

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

Verify operators
protected static operator ( string $operator, array\arraystring | integer> &$context, arrayinteger | string | array> &$vars ) : boolean | integer | null
$operator string the operator string
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | integer | null Return true when invalid or detected

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

validate partial
protected static partial ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : integer | boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 integer | boolean Return 1 or larger number for runtime partial, return true for other case

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

validate partial block token
protected static partialBlock ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean | null
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean | null Return true when partial block ends

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

push left string of current token and clear it
protected static pushLeft ( array\arraystring | integer> &$context )
$context array\arraystring | integer>

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

push current token into the section stack
protected static pushStack ( array\arraystring | integer> &$context, string $operation, arrayinteger | string | array> $vars )
$context array\arraystring | integer>
$operation string operation string
$vars arrayinteger | string | array>

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

push a token into the stack when it is not empty string
protected static pushToken ( array\arraystring | integer> &$context, string | array $token )
$context array\arraystring | integer>
$token string | array a parsed token or a string

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

handle raw block
protected static rawblock ( string[] &$token, array\arraystring | integer> &$context ) : boolean | null
$token string[] detected handlebars {{ }} token
$context array\arraystring | integer>
리턴 boolean | null Return true when in rawblock mode

resolveHelper() 공개 정적인 메소드

use helperresolver to resolve helper, return true when helper founded
public static resolveHelper ( array\arraystring | integer> &$context, string &$name ) : string | null
$context array\arraystring | integer>
$name string helper name
리턴 string | null $content helper function name or callable

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

validate section token
protected static section ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars, boolean $isEach = false ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
$isEach boolean the section is #each
리턴 boolean Return true always

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

Modify $token when spacing rules matched.
protected static spacing ( array &$token, array\arraystring | integer> &$context, boolean $nost = false ) : string | null
$token array
$context array\arraystring | integer>
$nost boolean do not do stand alone logic
리턴 string | null Return compiled code segment for the token

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

Collect handlebars usage information, detect template error.
protected static token ( string[] &$token, array\arraystring | integer> &$context )
$token string[] detected handlebars {{ }} token
$context array\arraystring | integer>

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

validate unless token
protected static unless ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean Return true always

verify() 공개 정적인 메소드

Verify template
public static verify ( array\arraystring | integer> &$context, string $template )
$context array\arraystring | integer>
$template string handlebars template

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

validate with token
protected static with ( array\arraystring | integer> &$context, arrayinteger | string | array> $vars ) : boolean
$context array\arraystring | integer>
$vars arrayinteger | string | array>
리턴 boolean Return true always