Beispiel #1
0
 /**
  * Add a tag to the document
  * @param XmlTag $tag, element to add
  * @param bool $generateTree, if set to true recreates the original tree structure
  */
 public function addTag(XmlTag $tag, $generateTree = false)
 {
     if ($generateTree) {
         $parent = $this->getTagByTagId($tag->getParentTagId());
         if ($parent instanceof XmlTag) {
             $parent->getChildren()->append($tag);
         } else {
             $this->_tags->append($tag);
         }
     } else {
         $this->_tags->append($tag);
     }
 }