PHP Класс Phly\Mustache\Lexer

Compiles mustache templates into a list of tokens.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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