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