ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleTokenParser Class Reference
+ Inheritance diagram for SimpleTokenParser:
+ Collaboration diagram for SimpleTokenParser:

Public Member Functions

 __construct ($tag, $grammar)
 
 getGrammar ()
 Gets the grammar as an object or as a string. More...
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 
 getNode (array $values, $line)
 Gets the nodes based on the parsed values. More...
 
- Public Member Functions inherited from Twig_Extensions_SimpleTokenParser
 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
- Public Member Functions inherited from Twig_TokenParser
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 
 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 

Protected Attributes

 $tag
 
 $grammar
 
- Protected Attributes inherited from Twig_TokenParser
 $parser
 

Additional Inherited Members

- Static Public Member Functions inherited from Twig_Extensions_SimpleTokenParser
static parseGrammar ($str, $main=true)
 
- Protected Member Functions inherited from Twig_Extensions_SimpleTokenParser
 getGrammar ()
 Gets the grammar as an object or as a string. More...
 
 getNode (array $values, $line)
 Gets the nodes based on the parsed values. More...
 
 getAttribute ($node, $attribute, $arguments=array(), $type=Twig_Node_Expression_GetAttr::TYPE_ANY, $line=-1)
 
 call ($node, $attribute, $arguments=array(), $line=-1)
 
 markAsSafe (Twig_Node $node, $line=-1)
 
 output (Twig_Node $node, $line=-1)
 
 getNodeValues (array $values)
 

Detailed Description

Definition at line 12 of file SimpleTokenParser.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleTokenParser::__construct (   $tag,
  $grammar 
)

Definition at line 17 of file SimpleTokenParser.php.

18 {
19 $this->tag = $tag;
20 $this->grammar = $grammar;
21 }

References $grammar, and $tag.

Member Function Documentation

◆ getGrammar()

SimpleTokenParser::getGrammar ( )

Gets the grammar as an object or as a string.

Returns
string|Twig_Extensions_Grammar A Twig_Extensions_Grammar instance or a string

Reimplemented from Twig_Extensions_SimpleTokenParser.

Definition at line 23 of file SimpleTokenParser.php.

24 {
25 return $this->grammar;
26 }

References $grammar.

◆ getNode()

SimpleTokenParser::getNode ( array  $values,
  $line 
)

Gets the nodes based on the parsed values.

Parameters
array$valuesAn array of values
int$lineThe parser line

Reimplemented from Twig_Extensions_SimpleTokenParser.

Definition at line 33 of file SimpleTokenParser.php.

34 {
35 $nodes = array();
36 $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant('|', $line), $line);
37 foreach ($values as $value) {
38 if ($value instanceof Twig_Node) {
39 if ($value instanceof Twig_Node_Expression_Array) {
40 $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Function('dump', $value, $line), $line);
41 } else {
42 $nodes[] = new Twig_Node_Print($value, $line);
43 }
44 } else {
45 $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant($value, $line), $line);
46 }
47 $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant('|', $line), $line);
48 }
49
50 return new Twig_Node($nodes);
51 }
Represents a node that outputs an expression.
Definition: Print.php:19
Represents a node in the AST.
Definition: Node.php:19

◆ getTag()

SimpleTokenParser::getTag ( )

Gets the tag name associated with this token parser.

Returns
string The tag name

Implements Twig_TokenParserInterface.

Definition at line 28 of file SimpleTokenParser.php.

29 {
30 return $this->tag;
31 }

References $tag.

Field Documentation

◆ $grammar

SimpleTokenParser::$grammar
protected

Definition at line 15 of file SimpleTokenParser.php.

Referenced by __construct(), and getGrammar().

◆ $tag

SimpleTokenParser::$tag
protected

Definition at line 14 of file SimpleTokenParser.php.

Referenced by __construct(), and getTag().


The documentation for this class was generated from the following file: