/** * Handles elements * * @param array(ezcTemplateTstNode) $elements * @return void */ public function handleElements($elements) { foreach ($elements as $element) { if ($element instanceof ezcTemplateBlockTstNode && $element->isClosingBlock) { // Check for closing of current block // echo ("Closing block: ". get_class( $element ) ."\n" ); $this->closeOpenBlock($element); $this->parser->symbolTable->decreaseScope(); } else { // This method throws an exception if the node cannot be attached. $element->canAttachToParent($this->lastBlock); $this->lastBlock->handleElement($element); if ($element instanceof ezcTemplateBlockTstNode && $element->isNestingBlock) { // No special handling required so we check if the element // is a nesting block and should start a new nesting level $element->parentBlock = $this->lastBlock; $this->lastBlock = $element; $this->parser->symbolTable->increaseScope(); } } } }