ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
SimpleTokenParser.php
Go to the documentation of this file.
1
<?
php
2
3
/*
4
* This file is part of Twig.
5
*
6
* (c) Fabien Potencier
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
class
SimpleTokenParser
extends
Twig_Extensions_SimpleTokenParser
13
{
14
protected
$tag
;
15
protected
$grammar
;
16
17
public
function
__construct
(
$tag
,
$grammar
)
18
{
19
$this->tag =
$tag
;
20
$this->grammar =
$grammar
;
21
}
22
23
public
function
getGrammar
()
24
{
25
return
$this->grammar
;
26
}
27
28
public
function
getTag
()
29
{
30
return
$this->tag
;
31
}
32
33
public
function
getNode
(array
$values
, $line)
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
}
52
}
Twig_Node
Represents a node in the AST.
Definition:
Node.php:18
SimpleTokenParser\getTag
getTag()
Gets the tag name associated with this token parser.
Definition:
SimpleTokenParser.php:28
SimpleTokenParser
Definition:
SimpleTokenParser.php:12
Twig_Node_Expression_Function
Definition:
Function.php:11
SimpleTokenParser\__construct
__construct($tag, $grammar)
Definition:
SimpleTokenParser.php:17
Twig_Extensions_SimpleTokenParser
Definition:
SimpleTokenParser.php:17
Twig_Node_Print
Represents a node that outputs an expression.
Definition:
Print.php:18
SimpleTokenParser\getGrammar
getGrammar()
Definition:
SimpleTokenParser.php:23
$values
$values
Definition:
testOperations.php:7
Twig_Node_Expression_Array
Definition:
Array.php:11
SimpleTokenParser\$grammar
$grammar
Definition:
SimpleTokenParser.php:15
Twig_Node_Expression_Constant
Definition:
Constant.php:12
SimpleTokenParser\getNode
getNode(array $values, $line)
Definition:
SimpleTokenParser.php:33
$nodes
$nodes
Definition:
addressbookserver.php:38
SimpleTokenParser\$tag
$tag
Definition:
SimpleTokenParser.php:14
php
libs
composer
vendor
twig
extensions
test
Twig
Tests
SimpleTokenParser.php
Generated on Thu Jan 16 2025 19:01:58 for ILIAS by
1.8.13 (using
Doxyfile
)