Debian Codegraph @

vendor/wikimedia/shellbox/src/ShellParser/SyntaxTree.php

raw
1 <?php
2
3 namespace Shellbox\ShellParser;
4
5 /**
6 * A wrapper for the shell syntax tree, providing a higher-level API.
7 */
8 class SyntaxTree {
9 /** @var Node */
10 private $root;
11
12 /**
13 * @internal Use ShellParser::parse()
14 *
15 * @param Node $root
16 */
17 public function __construct( $root ) {
18 $this->root = $root;
19 }
20
21 /**
22 * Get the root node
23 *
24 * @return Node
25 */
26 public function getRoot() {
27 return $this->root;
28 }
29
30 /**
31 * Extract information about the syntax tree
32 *
33 * @return SyntaxInfo
34 */
35 public function getInfo() {
36 return new SyntaxInfo( $this->root );
37 }
38 }