本文整理汇总了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));
}