Total Complexity | 6 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class SetTopicAttributeRequest extends BaseRequest |
||
9 | { |
||
10 | private $topicName; |
||
11 | private $attributes; |
||
12 | |||
13 | public function __construct($topicName, TopicAttributes $attributes = NULL) |
||
14 | { |
||
15 | parent::__construct('put', 'topics/' . $topicName . '?metaoverride=true'); |
||
16 | |||
17 | if ($attributes == NULL) |
||
18 | { |
||
19 | $attributes = new TopicAttributes(); |
||
20 | } |
||
21 | |||
22 | $this->topicName = $topicName; |
||
23 | $this->attributes = $attributes; |
||
24 | } |
||
25 | |||
26 | public function getTopicName() |
||
27 | { |
||
28 | return $this->topicName; |
||
29 | } |
||
30 | |||
31 | public function getTopicAttributes() |
||
32 | { |
||
33 | return $this->attributes; |
||
34 | } |
||
35 | |||
36 | public function generateBody() |
||
37 | { |
||
38 | $xmlWriter = new \XMLWriter; |
||
39 | $xmlWriter->openMemory(); |
||
40 | $xmlWriter->startDocument("1.0", "UTF-8"); |
||
41 | $xmlWriter->startElementNS(NULL, "Topic", Constants::MNS_XML_NAMESPACE); |
||
42 | $this->attributes->writeXML($xmlWriter); |
||
43 | $xmlWriter->endElement(); |
||
44 | $xmlWriter->endDocument(); |
||
45 | return $xmlWriter->outputMemory(); |
||
46 | } |
||
47 | |||
48 | public function generateQueryString() |
||
49 | { |
||
50 | return NULL; |
||
51 | } |
||
54 |