コード例 #1
0
 /**
  * @test
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 public function pushAndGetFromStackWorks()
 {
     $rootNode = new Tx_Fluid_Core_Parser_SyntaxTree_RootNode();
     $this->parsingState->pushNodeToStack($rootNode);
     $this->assertSame($rootNode, $this->parsingState->getNodeFromStack($rootNode), 'Node returned from stack was not the right one.');
     $this->assertSame($rootNode, $this->parsingState->popNodeFromStack($rootNode), 'Node popped from stack was not the right one.');
 }
コード例 #2
0
 /**
  * Initialize the given ViewHelper and adds it to the current node and to
  * the stack.
  *
  * @param Tx_Fluid_Core_Parser_ParsingState $state Current parsing state
  * @param string $namespaceIdentifier Namespace identifier - being looked up in $this->namespaces
  * @param string $methodIdentifier Method identifier
  * @param array $argumentsObjectTree Arguments object tree
  * @return void
  * @author Sebastian Kurfürst <*****@*****.**>
  * @author Karsten Dambekalns <*****@*****.**>
  */
 protected function initializeViewHelperAndAddItToStack(Tx_Fluid_Core_Parser_ParsingState $state, $namespaceIdentifier, $methodIdentifier, $argumentsObjectTree)
 {
     if (!array_key_exists($namespaceIdentifier, $this->namespaces)) {
         throw new Tx_Fluid_Core_Parser_Exception('Namespace could not be resolved. This exception should never be thrown!', 1224254792);
     }
     $viewHelper = $this->objectManager->create($this->resolveViewHelperName($namespaceIdentifier, $methodIdentifier));
     $expectedViewHelperArguments = $viewHelper->prepareArguments();
     $this->abortIfUnregisteredArgumentsExist($expectedViewHelperArguments, $argumentsObjectTree);
     $this->abortIfRequiredArgumentsAreMissing($expectedViewHelperArguments, $argumentsObjectTree);
     $currentDynamicNode = $this->objectManager->create('Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode', $viewHelper, $argumentsObjectTree);
     $state->getNodeFromStack()->addChildNode($currentDynamicNode);
     // PostParse Facet
     if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_Facets_PostParseInterface) {
         // Don't just use $viewHelper::postParseEvent(...),
         // as this will break with PHP < 5.3.
         call_user_func(array($viewHelper, 'postParseEvent'), $currentDynamicNode, $argumentsObjectTree, $state->getVariableContainer());
     }
     $this->callInterceptor($currentDynamicNode, Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER);
     $state->pushNodeToStack($currentDynamicNode);
 }