Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class PublishMessageRequest extends BaseRequest |
||
9 | { |
||
10 | use MessagePropertiesForPublish; |
||
11 | |||
12 | private $topicName; |
||
13 | |||
14 | public function __construct($messageBody, $messageAttributes = NULL) |
||
15 | { |
||
16 | parent::__construct('post', NULL); |
||
17 | |||
18 | $this->topicName = NULL; |
||
19 | $this->messageBody = $messageBody; |
||
20 | $this->messageAttributes = $messageAttributes; |
||
21 | } |
||
22 | |||
23 | public function setTopicName($topicName) |
||
24 | { |
||
25 | $this->topicName = $topicName; |
||
26 | $this->resourcePath = 'topics/' . $topicName . '/messages'; |
||
27 | } |
||
28 | |||
29 | public function getTopicName() |
||
30 | { |
||
31 | return $this->topicName; |
||
32 | } |
||
33 | |||
34 | public function generateBody() |
||
35 | { |
||
36 | $xmlWriter = new \XMLWriter; |
||
37 | $xmlWriter->openMemory(); |
||
38 | $xmlWriter->startDocument("1.0", "UTF-8"); |
||
39 | $xmlWriter->startElementNS(NULL, "Message", Constants::MNS_XML_NAMESPACE); |
||
40 | $this->writeMessagePropertiesForPublishXML($xmlWriter); |
||
41 | $xmlWriter->endElement(); |
||
42 | $xmlWriter->endDocument(); |
||
43 | return $xmlWriter->outputMemory(); |
||
44 | } |
||
45 | |||
46 | public function generateQueryString() |
||
47 | { |
||
48 | return NULL; |
||
49 | } |
||
52 |