public function trimLine(ezcTemplateWhitespaceRemoval $removal) { if (count($this->children) == 0) { return; } foreach ($this->children as $child) { if ($child instanceof ezcTemplateConditionBodyTstNode) { if (count($child->children) == 0) { continue; } // Tell the removal object to trim our first text child if ($child->children[0] instanceof ezcTemplateTextTstNode) { $removal->trimBlockLine($this, $child->children[0]); } // Tell the removal object to trim text blocks after the current block // and after all sub-blocks. $removal->trimBlockLines($this, $child->children); } } }
/** * Trims away the whitespace and EOL marker from the block line. * The whitespace and EOL marker is found in the first child element * which must be a text block element. * * Note: If a sub-class of this block element class uses another variable * than $children for child elements or uses multiple lists then it * needs to re-implement this method and call * $removal->trimBlockLine() for the correct list. * * @param ezcTemplateWhitespaceRemoval $removal * The removal object which knows how to get rid of block line whitespace. */ public function trimLine(ezcTemplateWhitespaceRemoval $removal) { if (count($this->children) == 0) { return; } if ($this->children[0] instanceof ezcTemplateTextTstNode) { // Tell the removal object to trim our first text child $removal->trimBlockLine($this, $this->children[0]); } // Tell the removal object to trim text blocks after the current block // and after all sub-blocks. $removal->trimBlockLines($this, $this->children); }