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


PHP ProtocolNode::getChildren方法代碼示例

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


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

示例1: writeInternal

 /**
  * @param ProtocolNode $node
  */
 protected function writeInternal($node)
 {
     $len = 1;
     if ($node->getAttributes() != null) {
         $len += count($node->getAttributes()) * 2;
     }
     if (count($node->getChildren()) > 0) {
         $len += 1;
     }
     if (strlen($node->getData()) > 0) {
         $len += 1;
     }
     $this->writeListStart($len);
     $this->writeString($node->getTag());
     $this->writeAttributes($node->getAttributes());
     if (strlen($node->getData()) > 0) {
         $this->writeBytes($node->getData());
     }
     if ($node->getChildren()) {
         $this->writeListStart(count($node->getChildren()));
         foreach ($node->getChildren() as $child) {
             $this->writeInternal($child);
         }
     }
 }
開發者ID:avary,項目名稱:WhatsApi,代碼行數:28,代碼來源:BinTreeNodeWriter.php

示例2: handleGroupV2InfoResponse

 /**
  * @param ProtocolNode $groupNode
  * @param mixed        $fromGetGroups
  */
 protected function handleGroupV2InfoResponse(ProtocolNode $groupNode, $fromGetGroups = false)
 {
     $creator = $groupNode->getAttribute('creator');
     $creation = $groupNode->getAttribute('creation');
     $subject = $groupNode->getAttribute('subject');
     $groupID = $groupNode->getAttribute('id');
     $participants = array();
     $admins = array();
     if ($groupNode->getChild(0) != null) {
         foreach ($groupNode->getChildren() as $child) {
             $participants[] = $child->getAttribute('jid');
             if ($child->getAttribute('type') == "admin") {
                 $admins[] = $child->getAttribute('jid');
             }
         }
     }
     $this->eventManager()->fire("onGetGroupV2Info", array($this->phoneNumber, $groupID, $creator, $creation, $subject, $participants, $admins, $fromGetGroups));
 }
開發者ID:rezanadimi72,項目名稱:Chat-API,代碼行數:22,代碼來源:whatsprot.class.php


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