Esempio n. 1
0
 /**
  * An utility method that simplifies inserting the text to the XML
  * tree. Depending on the last child type, it can create a new text
  * node or add the text to the existing one.
  *
  * @internal
  * @param Opt_Xml_Node $current The currently built XML node.
  * @param String|Opt_Xml_Node $text The text or the expression node.
  * @return Opt_Xml_Node The current XML node.
  */
 protected function _treeTextAppend($current, $text)
 {
     $last = $current->getLastChild();
     if (!is_object($last) || !$last instanceof Opt_Xml_Text) {
         if (!is_object($text)) {
             $node = new Opt_Xml_Text($text);
         } else {
             $node = new Opt_Xml_Text();
             $node->appendChild($text);
         }
         $current->appendChild($node);
     } else {
         if (!is_object($text)) {
             $last->appendData($text);
         } else {
             $last->appendChild($text);
         }
     }
     return $current;
 }
Esempio n. 2
0
 public function testTextGetType()
 {
     $buffer = new Opt_Xml_Text();
     $this->assertEquals('Opt_Xml_Text', $buffer->getType());
 }