TYPO3  7.6
ParsingState.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\Core\Parser;
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
20 {
26  protected $rootNode;
27 
33  protected $nodeStack = array();
34 
42  protected $variableContainer;
43 
49  protected $layoutNameNode;
50 
54  protected $compilable = true;
55 
62  public function setRootNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $rootNode)
63  {
64  $this->rootNode = $rootNode;
65  }
66 
72  public function getRootNode()
73  {
74  return $this->rootNode;
75  }
76 
83  public function render(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
84  {
85  return $this->rootNode->evaluate($renderingContext);
86  }
87 
95  public function pushNodeToStack(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node)
96  {
97  array_push($this->nodeStack, $node);
98  }
99 
105  public function getNodeFromStack()
106  {
107  return $this->nodeStack[count($this->nodeStack) - 1];
108  }
109 
115  public function popNodeFromStack()
116  {
117  return array_pop($this->nodeStack);
118  }
119 
125  public function countNodeStack()
126  {
127  return count($this->nodeStack);
128  }
129 
136  public function getVariableContainer()
137  {
139  }
140 
145  public function setLayoutNameNode(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $layoutNameNode)
146  {
147  $this->layoutNameNode = $layoutNameNode;
148  }
149 
153  public function getLayoutNameNode()
154  {
155  return $this->layoutNameNode;
156  }
157 
164  public function hasLayout()
165  {
166  return $this->layoutNameNode !== null;
167  }
168 
178  public function getLayoutName(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
179  {
180  if (!$this->hasLayout()) {
181  return null;
182  }
183  $layoutName = $this->layoutNameNode->evaluate($renderingContext);
184  if (!empty($layoutName)) {
185  return $layoutName;
186  }
187  throw new \TYPO3\CMS\Fluid\View\Exception('The layoutName could not be evaluated to a string', 1296805368);
188  }
189 
193  public function isCompilable()
194  {
195  return $this->compilable;
196  }
197 
201  public function setCompilable($compilable)
202  {
203  $this->compilable = $compilable;
204  }
205 
209  public function isCompiled()
210  {
211  return false;
212  }
213 }