当前位置: 首页>>代码示例>>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;未经允许,请勿转载。