| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\AbuseFilter\Parser; |
| 4 | |
| 5 | /** |
| 6 | * A class representing a whole AST generated by AFPTreeParser, holding AFPTreeNode's. This wrapper |
| 7 | * could be expanded in the future. For now, it's mostly useful for typehints, and to have an |
| 8 | * evalTree function in the evaluator. |
| 9 | */ |
| 10 | class AFPSyntaxTree { |
| 11 | /** |
| 12 | * @var AFPTreeNode|null |
| 13 | */ |
| 14 | private $rootNode; |
| 15 | |
| 16 | /** |
| 17 | * @param AFPTreeNode|null $root |
| 18 | */ |
| 19 | public function __construct( ?AFPTreeNode $root = null ) { |
| 20 | $this->rootNode = $root; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @return AFPTreeNode|null |
| 25 | */ |
| 26 | public function getRoot(): ?AFPTreeNode { |
| 27 | return $this->rootNode; |
| 28 | } |
| 29 | } |