| 1 | <?php |
||
| 8 | class SubscribeRequest extends BaseRequest |
||
| 9 | { |
||
| 10 | private $attributes; |
||
| 11 | |||
| 12 | public function __construct(SubscriptionAttributes $attributes) |
||
| 13 | { |
||
| 14 | parent::__construct('put', 'topics/' . $attributes->getTopicName() . '/subscriptions/' . $attributes->getSubscriptionName()); |
||
| 15 | |||
| 16 | $this->attributes = $attributes; |
||
| 17 | } |
||
| 18 | |||
| 19 | public function getSubscriptionAttributes() |
||
| 20 | { |
||
| 21 | return $this->attributes; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function generateBody() |
||
| 25 | { |
||
| 26 | $xmlWriter = new \XMLWriter; |
||
| 27 | $xmlWriter->openMemory(); |
||
| 28 | $xmlWriter->startDocument("1.0", "UTF-8"); |
||
| 29 | $xmlWriter->startElementNS(NULL, "Subscription", Constants::MNS_XML_NAMESPACE); |
||
| 30 | $this->attributes->writeXML($xmlWriter); |
||
| 31 | $xmlWriter->endElement(); |
||
| 32 | $xmlWriter->endDocument(); |
||
| 33 | return $xmlWriter->outputMemory(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function generateQueryString() |
||
| 37 | { |
||
| 38 | return NULL; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 43 |