Twig_Extensions_SimpleTokenParser
extends Twig_TokenParser
in package
Base class for all token parsers.
Tags
Table of Contents
- $parser : Parser
- parse() : Twig_Node
- Parses a token and returns a node.
- parseGrammar() : mixed
- setParser() : mixed
- Sets the parser associated with this token parser.
- call() : mixed
- getAttribute() : mixed
- getGrammar() : string|Twig_Extensions_Grammar
- Gets the grammar as an object or as a string.
- getNode() : mixed
- Gets the nodes based on the parsed values.
- getNodeValues() : mixed
- markAsSafe() : mixed
- output() : mixed
Properties
$parser
protected
Parser
$parser
Methods
parse()
Parses a token and returns a node.
public
parse(Twig_Token $token) : Twig_Node
Parameters
- $token : Twig_Token
-
A Twig_Token instance
Return values
Twig_Node —A Twig_Node instance
parseGrammar()
public
static parseGrammar(mixed $str[, mixed $main = true ]) : mixed
Parameters
- $str : mixed
- $main : mixed = true
Return values
mixed —setParser()
Sets the parser associated with this token parser.
public
setParser(Parser $parser) : mixed
Parameters
- $parser : Parser
Return values
mixed —call()
protected
call(mixed $node, mixed $attribute[, mixed $arguments = array() ][, mixed $line = -1 ]) : mixed
Parameters
- $node : mixed
- $attribute : mixed
- $arguments : mixed = array()
- $line : mixed = -1
Return values
mixed —getAttribute()
protected
getAttribute(mixed $node, mixed $attribute[, mixed $arguments = array() ][, mixed $type = Twig_Node_Expression_GetAttr::TYPE_ANY ][, mixed $line = -1 ]) : mixed
Parameters
- $node : mixed
- $attribute : mixed
- $arguments : mixed = array()
- $type : mixed = Twig_Node_Expression_GetAttr::TYPE_ANY
- $line : mixed = -1
Return values
mixed —getGrammar()
Gets the grammar as an object or as a string.
protected
abstract getGrammar() : string|Twig_Extensions_Grammar
Return values
string|Twig_Extensions_Grammar —A Twig_Extensions_Grammar instance or a string
getNode()
Gets the nodes based on the parsed values.
protected
abstract getNode(array<string|int, mixed> $values, int $line) : mixed
Parameters
- $values : array<string|int, mixed>
-
An array of values
- $line : int
-
The parser line
Return values
mixed —getNodeValues()
protected
getNodeValues(array<string|int, mixed> $values) : mixed
Parameters
- $values : array<string|int, mixed>
Return values
mixed —markAsSafe()
protected
markAsSafe(Twig_Node $node[, mixed $line = -1 ]) : mixed
Parameters
- $node : Twig_Node
- $line : mixed = -1
Return values
mixed —output()
protected
output(Twig_Node $node[, mixed $line = -1 ]) : mixed
Parameters
- $node : Twig_Node
- $line : mixed = -1