RMS\PushNotificationsBundle\Service\OS\BlackberryNotification::getXMLBody PHP Метод

getXMLBody() приватный Метод

Create the XML body that accompanies the actual push data
private getXMLBody ( RMS\PushNotificationsBundle\Message\BlackberryMessage $message, $messageID ) : string
$message RMS\PushNotificationsBundle\Message\BlackberryMessage
$messageID
Результат string
    private function getXMLBody(BlackberryMessage $message, $messageID)
    {
        $deliverBefore = gmdate('Y-m-d\\TH:i:s\\Z', strtotime('+5 minutes'));
        $impl = new \DOMImplementation();
        $dtd = $impl->createDocumentType("pap", "-//WAPFORUM//DTD PAP 2.1//EN", "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd");
        $doc = $impl->createDocument("", "", $dtd);
        // Build it centre-out
        $pm = $doc->createElement("push-message");
        $pm->setAttribute("push-id", $messageID);
        $pm->setAttribute("deliver-before-timestamp", $deliverBefore);
        $pm->setAttribute("source-reference", $this->appID);
        $qos = $doc->createElement("quality-of-service");
        $qos->setAttribute("delivery-method", "unconfirmed");
        $add = $doc->createElement("address");
        $add->setAttribute("address-value", $message->getDeviceIdentifier());
        $pm->appendChild($add);
        $pm->appendChild($qos);
        $pap = $doc->createElement("pap");
        $pap->appendChild($pm);
        $doc->appendChild($pap);
        return $doc->saveXML();
    }