| Total Complexity | 7 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class RootNode extends Node |
||
| 13 | { |
||
| 14 | /** @var Node[] */ |
||
| 15 | protected $subnodes = []; |
||
| 16 | |||
| 17 | protected $attr = []; |
||
| 18 | |||
| 19 | public function __construct($data, Node $ignored = null) |
||
| 20 | { |
||
| 21 | $this->attr = $data['attrs'] ?? null; |
||
| 22 | foreach ($data['content'] as $node) { |
||
| 23 | $this->subnodes[] = self::getSubNode($node, $this); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function toSyntax() |
||
| 28 | { |
||
| 29 | $doc = ''; |
||
| 30 | foreach ($this->subnodes as $subnode) { |
||
| 31 | $doc .= $subnode->toSyntax(); |
||
| 32 | $doc = rtrim($doc); |
||
| 33 | $doc .= "\n\n"; |
||
| 34 | } |
||
| 35 | $doc .= $this->getMacroSyntax(); |
||
| 36 | return $doc; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the syntax for each active macro |
||
| 41 | * |
||
| 42 | * This produces the syntax representation for the and NOCACHE NOTOC macros |
||
| 43 | * |
||
| 44 | * @return string empty string or a string with a line for each active macro |
||
| 45 | */ |
||
| 46 | protected function getMacroSyntax() |
||
| 56 | } |
||
| 57 | } |
||
| 58 |