当前位置: 首页>>代码示例>>PHP>>正文


PHP Node::fromObject方法代码示例

本文整理汇总了PHP中Node::fromObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::fromObject方法的具体用法?PHP Node::fromObject怎么用?PHP Node::fromObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node的用法示例。


在下文中一共展示了Node::fromObject方法的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) {
         $t->root = Node::fromObject($payload, $root);
     } else {
         if (is_array($payload)) {
             $t->root = Node::fromArray($payload, $root);
         } else {
             $t->root = new Node($root, $payload);
         }
     }
     return $t->getDeclaration() . "\n" . $t->getSource(INDENT_NONE);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:27,代码来源:RestXmlSerializer.class.php

示例2: addFormError

 /**
  * Adds an error. The XML representation will look like this:
  * <xmp>
  *   <error
  *    checker="foo.bar.wrapper.MyLoginDataChecker"
  *    type="user_nonexistant"
  *    field="username"                    
  *   />                                                 
  * </xmp>
  *
  * @param   string checker The class checking the input
  * @param   string type The error type
  * @param   string field default '*' The form field corresponding
  * @param   var info default NULL 
  * @return  bool FALSE
  */
 public function addFormError($checker, $type, $field = '*', $info = NULL)
 {
     if (is_array($info)) {
         $c = Node::fromArray($info, 'error');
     } else {
         if (is_object($info)) {
             $c = Node::fromObject($info, 'error');
         } else {
             $c = new Node('error', $info);
         }
     }
     $c->setAttributes(array('type' => $type, 'field' => $field, 'checker' => $checker));
     $this->document->formerrors->addChild($c);
     return FALSE;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:31,代码来源:XMLScriptletResponse.class.php

示例3: fromObject

    public function fromObject()
    {
        $this->assertEquals("<node>\n" . "  <id>1549</id>\n" . "  <color>green</color>\n" . "  <name>Name goes here</name>\n" . "  <__id/>\n" . "</node>", $this->sourceOf(Node::fromObject(newinstance('lang.Object', array(), '{
          public $id= 1549;
          public $color= "green";
          public $name;

          public function __construct() {
            $this->name= new String("Name goes here");
          } 
        }'), 'node')));
    }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:12,代码来源:NodeTest.class.php

示例4: dateFormatCallbackWithoutTZ

 public function dateFormatCallbackWithoutTZ()
 {
     $date = new Date('2009-09-20 21:33:00');
     $this->assertEquals($date->toString('Y-m-d H:i:s T'), $this->runTransformation(Node::fromObject($date, 'date')->getSource(), 'xp.date::format', array('string(/date/value)', "'Y-m-d H:i:s T'")));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:5,代码来源:XslCallbackTest.class.php

示例5: writeInterfaces

 public function writeInterfaces($description, $output)
 {
     static $purposes = array(HOME_INTERFACE => 'home', REMOTE_INTERFACE => 'remote');
     foreach ($description->getInterfaces() as $type => $interface) {
         $node = Node::fromObject($interface, 'interface');
         $node->setAttribute('purpose', $purposes[$type]);
         $node->addChild(new Node('jndiName', $this->jndi));
         $this->processor->setXMLBuf($node->getSource(INDENT_NONE));
         $this->processor->run();
         $output->append(strtr($interface->getClassName(), '.', '/') . xp::CLASS_FILE_EXT, $this->processor->output());
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:12,代码来源:Generator.class.php


注:本文中的Node::fromObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。