PHP 클래스 Phly\Mustache\Lexer

Compiles mustache templates into a list of tokens.
파일 보기 프로젝트 열기: phly/phly_mustache 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$manager Phly\Mustache\Mustache The Mustache manager
$nestingLevel integer Current nesting level in hierarchical templates
$patterns array Patterns referenced by lexer
$placeholders array Array is keyed based on current $nestingLevel
$stripWhitespaceFlag boolean Whether or not to strip whitespace
$whitespaceCharacters Whitespace characters that occur in tags.

공개 메소드들

메소드 설명
compile ( string $string, null | string $templateName = null ) : array Compile a string into a set of tokens
disableStripWhitespace ( null | boolean $flag = null ) : boolean | Lexer Set or get the flag indicating whether or not to strip whitespace
getManager ( ) : null | Phly\Mustache\Mustache Retrieve the mustache manager
setManager ( Phly\Mustache\Mustache $manager ) : Lexer Set mustache manager

보호된 메소드들

메소드 설명
implodePregQuote ( string $glue, array $pieces, string $delimiter = null ) : string Implode and preg_quote() an array of $pieces
replaceTokens ( array $originalTokens, array $replacements ) : array Inject replacements from template inheritance
stripWhitespace ( ref &$tokens, integer $position ) : void Strip whitespace in content tokens surrounding a given token

메소드 상세

compile() 공개 메소드

Compile a string into a set of tokens
public compile ( string $string, null | string $templateName = null ) : array
$string string
$templateName null | string Template to use in the case of a partial
리턴 array

disableStripWhitespace() 공개 메소드

Set or get the flag indicating whether or not to strip whitespace
public disableStripWhitespace ( null | boolean $flag = null ) : boolean | Lexer
$flag null | boolean Null indicates retrieving; boolean value sets
리턴 boolean | Lexer

getManager() 공개 메소드

Retrieve the mustache manager
public getManager ( ) : null | Phly\Mustache\Mustache
리턴 null | Phly\Mustache\Mustache

implodePregQuote() 보호된 메소드

Implode and preg_quote() an array of $pieces
protected implodePregQuote ( string $glue, array $pieces, string $delimiter = null ) : string
$glue string String to join $pieces with
$pieces array Strings to be quoted then joined
$delimiter string The delimiter required by PCRE functions If included, it will also be escaped
리턴 string

replaceTokens() 보호된 메소드

Inject replacements from template inheritance
protected replaceTokens ( array $originalTokens, array $replacements ) : array
$originalTokens array
$replacements array
리턴 array

setManager() 공개 메소드

Used internally to resolve and tokenize partials
public setManager ( Phly\Mustache\Mustache $manager ) : Lexer
$manager Phly\Mustache\Mustache
리턴 Lexer

stripWhitespace() 보호된 메소드

Strip whitespace in content tokens surrounding a given token
protected stripWhitespace ( ref &$tokens, integer $position ) : void
$tokens ref Reference to the tokens array
$position integer
리턴 void

프로퍼티 상세

$manager 보호되어 있는 프로퍼티

The Mustache manager
protected Mustache,Phly\Mustache $manager
리턴 Phly\Mustache\Mustache

$nestingLevel 보호되어 있는 프로퍼티

Current nesting level in hierarchical templates
protected int $nestingLevel
리턴 integer

$patterns 보호되어 있는 프로퍼티

Patterns referenced by lexer
protected array $patterns
리턴 array

$placeholders 보호되어 있는 프로퍼티

Array is keyed based on current $nestingLevel
protected array $placeholders
리턴 array

$stripWhitespaceFlag 보호되어 있는 프로퍼티

Whether or not to strip whitespace
protected bool $stripWhitespaceFlag
리턴 boolean

$whitespaceCharacters 보호되어 있는 프로퍼티

Whitespace characters that occur in tags.
protected $whitespaceCharacters