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


PHP Node::setValue方法代码示例

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


在下文中一共展示了Node::setValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTextElement

 function createTextElement($text)
 {
     $node = new Node();
     $node->setType(TEXTELEMENT);
     $node->setValue($text);
     return $node;
 }
开发者ID:digideskio,项目名称:oscmax2,代码行数:7,代码来源:xmldocument.php

示例2: xmlToObject

 /**
  * Converts an XML string into an object struct.
  *
  * @param string $data The XML string
  *
  * @return esXml The parsed XML
  */
 private function xmlToObject($data)
 {
     $root = new Node();
     $root->setName('root');
     $actualLevel = 1;
     $actualNode = $root;
     $stack = array();
     $stack[1] = $root;
     foreach ($this->parseIntoStruct($data) as $element) {
         if ($element['type'] === 'close') {
             continue;
         }
         $node = new Node();
         $node->setName($element['tag']);
         if (isset($element['attributes'])) {
             $node->setAttributes($element['attributes']);
         }
         if (isset($element['value'])) {
             $node->setValue($element['value']);
         }
         $level = $element['level'];
         if ($level > $actualLevel) {
             $stack[$level] = $actualNode;
         }
         $stack[$level]->addChild($node);
         $actualNode = $node;
         $actualLevel = $element['level'];
     }
     $children = $root->getChildren();
     unset($root);
     return $children[0]->setParent(null);
 }
开发者ID:dborsatto,项目名称:object-xml,代码行数:39,代码来源:Manager.php

示例3: __construct

 /**
  * @param array $config
  * @param array $params
  * @throws ApiRequestException
  */
 public function __construct(array $config, array $params = [])
 {
     $filterNode = new Node('filter');
     if (isset($params['key'])) {
         $filterNode->setValue(new Node('key', $params['key']));
     }
     if (isset($params['keys']) && is_array($params['keys'])) {
         $nodes = [];
         foreach ($params['keys'] as $key) {
             $nodes[] = new Node('key', $key);
         }
         $filterNode->setValue(new NodeList($nodes));
     }
     $params['filter'] = $filterNode;
     parent::__construct($config, $params);
 }
开发者ID:ghermans,项目名称:php-plesk,代码行数:21,代码来源:ListSecretKeys.php

示例4: insertFirst

 /**
  * 头插法
  * @param unknown_type $value
  */
 public function insertFirst($value)
 {
     $new = new Node(null, $value);
     $new->setValue($value);
     $new->next = $this->head->next;
     $this->head->next = $new;
 }
开发者ID:liudaiming,项目名称:Datastructure,代码行数:11,代码来源:SingleLink.php

示例5: readType

 /**
  * Read an individual type from the stream.
  *
  * @param resource $fPtr    Stream pointer
  * @param int      $tagType Tag to read
  * @param Node     $node    Node to add data to
  *
  * @return mixed
  */
 private function readType($fPtr, $tagType, Node $node)
 {
     switch ($tagType) {
         case Tag::TAG_BYTE:
             // Signed byte (8 bit)
             $node->setValue($this->dataHandler->getTAGByte($fPtr));
             break;
         case Tag::TAG_SHORT:
             // Signed short (16 bit, big endian)
             $node->setValue($this->dataHandler->getTAGShort($fPtr));
             break;
         case Tag::TAG_INT:
             // Signed integer (32 bit, big endian)
             $node->setValue($this->dataHandler->getTAGInt($fPtr));
             break;
         case Tag::TAG_LONG:
             // Signed long (64 bit, big endian)
             $node->setValue($this->dataHandler->getTAGLong($fPtr));
             break;
         case Tag::TAG_FLOAT:
             // Floating point value (32 bit, big endian, IEEE 754-2008)
             $node->setValue($this->dataHandler->getTAGFloat($fPtr));
             break;
         case Tag::TAG_DOUBLE:
             // Double value (64 bit, big endian, IEEE 754-2008)
             $node->setValue($this->dataHandler->getTAGDouble($fPtr));
             break;
         case Tag::TAG_BYTE_ARRAY:
             // Byte array
             $node->setValue($this->dataHandler->getTAGByteArray($fPtr));
             break;
         case Tag::TAG_STRING:
             // String
             $node->setValue($this->dataHandler->getTAGString($fPtr));
             break;
         case Tag::TAG_INT_ARRAY:
             $node->setValue($this->dataHandler->getTAGIntArray($fPtr));
             break;
         case Tag::TAG_LIST:
             // List
             $tagID = $this->dataHandler->getTAGByte($fPtr);
             $listLength = $this->dataHandler->getTAGInt($fPtr);
             // Add a reference to the payload type
             $node->setPayloadType($tagID);
             for ($i = 0; $i < $listLength; ++$i) {
                 if (feof($fPtr)) {
                     break;
                 }
                 $listNode = new Node();
                 $this->readType($fPtr, $tagID, $listNode);
                 $node->addChild($listNode);
             }
             break;
         case Tag::TAG_COMPOUND:
             // Compound
             // Uck. Don't know a better way to do this,
             $compoundNode = new Node();
             while ($this->traverseTag($fPtr, $compoundNode)) {
                 $node->addChild($compoundNode);
                 // Reset the node for adding the next tags
                 $compoundNode = new Node();
             }
             break;
     }
 }
开发者ID:rickselby,项目名称:nbt,代码行数:74,代码来源:Service.php


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