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


PHP Node::getValue方法代碼示例

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


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

示例1: equals

 /**
  * @see \Saft\Node
  */
 public function equals(Node $toCompare)
 {
     // Only compare, if given instance is a literal
     if ($toCompare->isLiteral() && $this->getDatatype()->equals($toCompare->getDatatype())) {
         return $this->getValue() === $toCompare->getValue() && $this->getLanguage() == $toCompare->getLanguage();
     }
     return false;
 }
開發者ID:guitarmarx,項目名稱:Saft,代碼行數:11,代碼來源:AbstractLiteral.php

示例2: toArray

 /**
  * Returns an array representation of the given Node structure.
  *
  * @param Node $node
  *
  * @return array
  */
 public function toArray(Node $node)
 {
     return array('name' => $node->getName(), 'value' => $node->getValue(), 'attributes' => $node->getAttributes(), 'children' => array_map(function (Node $child) {
         return $this->toArray($child);
     }, $node->getChildren()));
 }
開發者ID:dborsatto,項目名稱:object-xml,代碼行數:13,代碼來源:Manager.php

示例3: matches

 /**
  * A literal matches only another literal if its value, datatype and language are equal.
  *
  * @param  Node    $toMatch Node instance to apply the pattern on
  * @return boolean true, if this pattern matches the node, false otherwise
  * @todo check if that could be deleted
  */
 public function matches(Node $toMatch)
 {
     if ($toMatch->isConcrete()) {
         if ($toMatch instanceof Literal) {
             return $this->getValue() === $toMatch->getValue() && $this->getDatatype() === $toMatch->getDatatype() && $this->getLanguage() === $toMatch->getLanguage();
         }
         return false;
     } else {
         throw new \Exception('The node to match has to be a concrete node');
     }
 }
開發者ID:guitarmarx,項目名稱:Saft,代碼行數:18,代碼來源:LiteralPatternImpl.php

示例4: writeType

 /**
  * Write an individual type to the stream.
  *
  * @param resource $fPtr    Stream pointer
  * @param int      $tagType Type of tag to write
  * @param Node     $node    Node containing value to write
  *
  * @return bool
  */
 private function writeType($fPtr, $tagType, Node $node)
 {
     switch ($tagType) {
         case Tag::TAG_BYTE:
             // Signed byte (8 bit)
             return $this->dataHandler->putTAGByte($fPtr, $node->getValue());
         case Tag::TAG_SHORT:
             // Signed short (16 bit, big endian)
             return $this->dataHandler->putTAGShort($fPtr, $node->getValue());
         case Tag::TAG_INT:
             // Signed integer (32 bit, big endian)
             return $this->dataHandler->putTAGInt($fPtr, $node->getValue());
         case Tag::TAG_LONG:
             // Signed long (64 bit, big endian)
             return $this->dataHandler->putTAGLong($fPtr, $node->getValue());
         case Tag::TAG_FLOAT:
             // Floating point value (32 bit, big endian, IEEE 754-2008)
             return $this->dataHandler->putTAGFloat($fPtr, $node->getValue());
         case Tag::TAG_DOUBLE:
             // Double value (64 bit, big endian, IEEE 754-2008)
             return $this->dataHandler->putTAGDouble($fPtr, $node->getValue());
         case Tag::TAG_BYTE_ARRAY:
             // Byte array
             return $this->dataHandler->putTAGByteArray($fPtr, $node->getValue());
         case Tag::TAG_STRING:
             // String
             return $this->dataHandler->putTAGString($fPtr, $node->getValue());
         case Tag::TAG_INT_ARRAY:
             // Byte array
             return $this->dataHandler->putTAGIntArray($fPtr, $node->getValue());
         case Tag::TAG_LIST:
             // List
             if (!($this->dataHandler->putTAGByte($fPtr, $node->getPayloadType()) && $this->dataHandler->putTAGInt($fPtr, count($node->getChildren())))) {
                 return false;
             }
             foreach ($node->getChildren() as $childNode) {
                 if (!$this->writeType($fPtr, $node->getPayloadType(), $childNode)) {
                     return false;
                 }
             }
             return true;
         case Tag::TAG_COMPOUND:
             // Compound
             foreach ($node->getChildren() as $childNode) {
                 if (!$this->writeTag($fPtr, $childNode)) {
                     return false;
                 }
             }
             if (!$this->writeType($fPtr, Tag::TAG_END, new Node())) {
                 return false;
             }
             return true;
         case Tag::TAG_END:
             // End tag
             return is_int(fwrite($fPtr, ""));
     }
 }
開發者ID:rickselby,項目名稱:nbt,代碼行數:66,代碼來源:Service.php


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