當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tree::getSource方法代碼示例

本文整理匯總了PHP中Tree::getSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tree::getSource方法的具體用法?PHP Tree::getSource怎麽用?PHP Tree::getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tree的用法示例。


在下文中一共展示了Tree::getSource方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: serialize

 /**
  * Serialize
  *
  * @param   var value
  * @return  string
  */
 public function serialize($payload)
 {
     $t = new Tree();
     $t->setEncoding('UTF-8');
     if ($payload instanceof Payload) {
         $root = isset($payload->properties['name']) ? $payload->properties['name'] : 'root';
         $payload = $payload->value;
     } else {
         $root = 'root';
     }
     if ($payload instanceof Generic || is_array($payload)) {
         $t->root = Node::fromArray($this->convert($payload), $root);
     } else {
         $t->root = new Node($root, $this->convert($payload));
     }
     return $t->getDeclaration() . "\n" . $t->getSource(INDENT_NONE);
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:23,代碼來源:RestXmlSerializer.class.php

示例2: setXMLTree

 /**
  * Set XML from a tree
  *
  * @param   xml.Tree xml
  */
 public function setXMLTree(Tree $xml)
 {
     libxml_get_last_error() && libxml_clear_errors();
     $this->document = new DOMDocument();
     $this->document->loadXML($xml->getDeclaration() . $xml->getSource(INDENT_NONE));
     $this->_checkErrors($xml);
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:12,代碼來源:DomXSLProcessor.class.php

示例3: marshal

 /**
  * Marshal an object to xml
  *
  * @param   lang.Object instance
  * @param   xml.QName qname default NULL
  * @return  string xml
  * @deprecated  Use marshalTo() instead
  */
 public static function marshal($instance, $qname = NULL)
 {
     $class = $instance->getClass();
     // Create XML tree and root node. Use the information provided by the
     // qname argument if existant, use the class` non-qualified (and
     // lowercased) name otherwise.
     $tree = new Tree();
     if ($qname) {
         $prefix = $qname->prefix ? $qname->prefix : $qname->localpart[0];
         $tree->root()->setName($prefix . ':' . $qname->localpart);
         $tree->root()->setAttribute('xmlns:' . $prefix, $qname->namespace);
     } else {
         if ($class->hasAnnotation('xmlns')) {
             $tree->root()->setName($class->getSimpleName());
         } else {
             $tree->root()->setName(strtolower($class->getSimpleName()));
         }
     }
     self::recurse($instance, $class, $tree->root(), array());
     return $tree->getSource(INDENT_DEFAULT);
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:29,代碼來源:Marshaller.class.php

示例4: performance

 public function performance()
 {
     $s = microtime(TRUE);
     $t = new Tree();
     for ($i = 0; $i < 100; $i++) {
         $c = $t->addChild(new Node('child', NULL, array('id' => $i)));
         for ($j = 0; $j < 100; $j++) {
             $c->addChild(new Node('elements', str_repeat('x', $j)));
         }
     }
     $l = strlen($t->getSource(INDENT_NONE));
     printf('%d bytes, %.3f seconds', $l, microtime(TRUE) - $s);
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:13,代碼來源:TreeTest.class.php

示例5: getSource

 /**
  * Returns the full XML source of the 'dia' diagram
  *
  * @return  string XML representation of the DIAgramm
  */
 public function getSource($indent = INDENT_DEFAULT)
 {
     $Node = $this->getNode();
     $Tree = new Tree();
     $Tree->root = $Node;
     return $Tree->getDeclaration() . "\n" . $Tree->getSource($indent);
 }
開發者ID:Gamepay,項目名稱:xp-contrib,代碼行數:12,代碼來源:DiaDiagram.class.php


注:本文中的Tree::getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。