Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
CRAP
75.00% covered (warning)
75.00%
3 / 4
SyntaxTree
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
3.14
75.00% covered (warning)
75.00%
3 / 4
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getRoot
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getInfo
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
namespace Shellbox\ShellParser;
/**
 * A wrapper for the shell syntax tree, providing a higher-level API.
 */
class SyntaxTree {
    /** @var Node */
    private $root;
    /**
     * @internal Use ShellParser::parse()
     *
     * @param Node $root
     */
    public function __construct( $root ) {
        $this->root = $root;
    }
    /**
     * Get the root node
     *
     * @return Node
     */
    public function getRoot() {
        return $this->root;
    }
    /**
     * Extract information about the syntax tree
     *
     * @return SyntaxInfo
     */
    public function getInfo() {
        return new SyntaxInfo( $this->root );
    }
}