blob: 3981598a0c21cb3900ed653694a704e526cc468f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
namespace exTpl;
/**
* ArrayNode represents a sequence of arbitrary nodes.
*/
class ArrayNode implements Node
{
protected array $nodes = [];
/**
* Adds a child node to this sequence node.
*
* @param Node $node child node to add
*/
public function addChild(Node $node): void
{
$this->nodes[] = $node;
}
/**
* Returns a string representation of this node.
*
* @param Context $context symbol table
*/
public function render(Context $context): string
{
$result = '';
foreach ($this->nodes as $node) {
$result .= $node->render($context);
}
return $result;
}
}
|