當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。