/** * @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); }
/** * @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); }