示例#1
0
 /**
  * @param Client        $client
  * @param NodeInterface $node
  */
 protected function sendNotificationAck(Client $client, NodeInterface $node)
 {
     $ackNode = new Node();
     if ($node->hasAttribute("to")) {
         $ackNode->setAttribute('from', $node->getAttribute("to"));
     }
     if ($node->hasAttribute("participant")) {
         $ackNode->setAttribute('participant', $node->getAttribute("participant"));
     }
     $ackNode->setAttribute('to', $node->getAttribute("from"));
     $ackNode->setAttribute('class', $node->getName());
     $ackNode->setAttribute('id', $node->getAttribute("id"));
     $ackNode->setAttribute('type', $node->getAttribute("type"));
     $client->sendNode($ackNode);
 }
示例#2
0
 /**
  * @param  NodeInterface $node
  * @return bool
  */
 protected function canInjectId(NodeInterface $node)
 {
     if (!$node->hasAttribute('id')) {
         return false;
     }
     $id = $node->getAttribute('id');
     return null === $id || '-' === substr($id, -1, 1);
 }