PhpWriter
class PhpWriter
PHP code generator helpers.
Methods
Expands %node.word, %node.array, %node.args, %escape(), %modify(), %var, %raw, %word in code.
Formats modifiers calling.
Formats macro arguments to PHP code. (It advances tokenizer to the end as a side effect.)
Formats macro arguments to PHP array. (It advances tokenizer to the end as a side effect.)
Formats parameter to PHP string.
Preprocessor for tokens. (It advances tokenizer to the end as a side effect.)
Details
at line 28
static
using(MacroNode $node)
No description
at line 36
__construct(MacroTokens $tokens, $modifiers = null, array $context = null)
No description
at line 49
string
write($mask)
Expands %node.word, %node.array, %node.args, %escape(), %modify(), %var, %raw, %word in code.
at line 107
string
formatModifiers($var, $isContent = false)
Formats modifiers calling.
at line 121
string
formatArgs(MacroTokens $tokens = null)
Formats macro arguments to PHP code. (It advances tokenizer to the end as a side effect.)
at line 133
string
formatArray(MacroTokens $tokens = null)
Formats macro arguments to PHP array. (It advances tokenizer to the end as a side effect.)
at line 147
string
formatWord($s)
Formats parameter to PHP string.
at line 159
MacroTokens
preprocess(MacroTokens $tokens = null)
Preprocessor for tokens. (It advances tokenizer to the end as a side effect.)
at line 175
void
validateTokens(MacroTokens $tokens)
No description
at line 220
MacroTokens
removeCommentsPass(MacroTokens $tokens)
Removes PHP comments.
at line 236
MacroTokens
shortTernaryPass(MacroTokens $tokens)
Simplified ternary expressions without third part.
at line 265
MacroTokens
expandCastPass(MacroTokens $tokens)
Pseudocast (expand).
at line 294
MacroTokens
quotingPass(MacroTokens $tokens)
Quotes symbols to strings.
at line 314
MacroTokens
inOperatorPass(MacroTokens $tokens)
Syntax $entry in [item1, item2].
at line 350
MacroTokens
inlineModifierPass(MacroTokens $tokens)
Process inline filters ($var|filter)
at line 415
MacroTokens
modifierPass(MacroTokens $tokens, $var, $isContent = false)
Formats modifiers calling.
at line 472
MacroTokens
escapePass(MacroTokens $tokens)
Escapes expression in tokens.
Traits
Better OOP experience.