本文整理匯總了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);
}
}
}
示例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));
}